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

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