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

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