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

Last change on this file since 19686 was 19527, checked in by tbretz, 5 years ago
There was a ] too much already for a while...
  • 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 [`date -u`]
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 [`date -u`]
53 echo
54
55 # HUP 1 exit
56 # INT 2 exit
57 # QUIT 3 core
58 # ILL 4 core
59 # TRAP 5 core
60 # ABRT 6 core
61 # FPE 8 core
62 # KILL 9 exit
63 # SEGV 11 core
64 # PIPE 13 exit
65 # ALRM 14 exit
66 # TERM 15 exit
67
68 # 0 (User requested exit from the command line)
69 # 1- (Eval options failed, return code of StateMachineImp::Run)
70 # 126 (shutdown requested)
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.