source: trunk/FACT++/start.sh@ 17862

Last change on this file since 17862 was 17405, checked in by tbretz, 11 years ago
Change working directory to directory which contains the link or the start.sh to ensure that relative links work properly.
  • Property svn:executable set to *
File size: 1.6 KB
Line 
1#!/bin/bash --login
2
3cd `dirname "$0"`
4
5CALL=`basename "$0"`
6LINK=`readlink "$0"`
7
8if [ -n "$LINK" -a $CALL != 'start.sh' ]; then
9 DIR=`dirname "$LINK"`
10 PRG=$DIR/$CALL
11 CMD=$PRG" "$*
12else
13 DIR=`dirname "$0"`
14 PRG=$DIR/$1
15 CMD=$DIR/$*
16fi
17
18if [ "$CALL" = "fadctrl" ]; then
19 NICE="ionice -c 2 -n 0"
20fi
21
22# echo DIR=$DIR
23# echo PRG=$PRG
24# echo CMD=$CMD
25
26while [ true ]; do
27
28 reset
29
30 if [ -n "$RC" ]; then
31 echo LAST RETURN CODE=$RC
32 fi
33
34 echo COMMAND=$NICE $CMD
35 echo
36
37 if [ ! -x $PRG ]; then
38 echo $1 not available... waiting 5s.
39 sleep 5
40 continue
41 fi
42
43 if [ -e $DIR/compiling.lock ]; then
44 echo Compilation in progress... waiting 1s.
45 sleep 1
46 continue
47 fi
48
49 $NICE $CMD
50 RC=$?
51
52 echo RETURN CODE=$RC
53 date
54 echo
55
56 # HUP 1 exit
57 # INT 2 exit
58 # QUIT 3 core
59 # ILL 4 core
60 # TRAP 5 core
61 # ABRT 6 core
62 # FPE 8 core
63 # KILL 9 exit
64 # SEGV 11 core
65 # PIPE 13 exit
66 # ALRM 14 exit
67 # TERM 15 exit
68
69 # 0 (User requested exit from the command line)
70 # 1- (Eval options failed, return code of StateMachineImp::Run)
71 # 126 (exit requested from recompile.sh)
72 # 127 (problem with option parsing or no program start, like --help)
73 # 128 (exit(128))
74 # 134 (ABRT, double corruption, abort())
75 # 139 (SEGV, 128+11)
76 # 255 (exception)
77
78 if [ $RC -eq 126 ]; then
79 continue
80 fi
81
82 # RC<=128 || RC==KILL || RC=TERM || RC=exception
83 if [ $RC -le 128 ] || [ $RC -eq 137 ] || [ $RC -eq 143 ] || [ $RC -eq 255 ] ]; then
84 exit
85 fi
86
87done
Note: See TracBrowser for help on using the repository browser.