Last change
on this file since 16991 was 15332, checked in by tbretz, 12 years ago |
Print date when a program returns
|
-
Property svn:executable
set to
*
|
File size:
1.5 KB
|
Line | |
---|
1 | #!/bin/bash --login
|
---|
2 |
|
---|
3 | CALL=`basename "$0"`
|
---|
4 | LINK=`readlink "$0"`
|
---|
5 |
|
---|
6 | if [ -n "$LINK" -a $CALL != 'start.sh' ]; then
|
---|
7 | DIR=`dirname "$LINK"`
|
---|
8 | PRG=$DIR/$CALL
|
---|
9 | CMD=$PRG" "$*
|
---|
10 | else
|
---|
11 | DIR=`dirname "$0"`
|
---|
12 | PRG=$DIR/$1
|
---|
13 | CMD=$DIR/$*
|
---|
14 | fi
|
---|
15 |
|
---|
16 | # echo DIR=$DIR
|
---|
17 | # echo PRG=$PRG
|
---|
18 | # echo CMD=$CMD
|
---|
19 |
|
---|
20 | while [ 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 | date
|
---|
48 | echo
|
---|
49 |
|
---|
50 | # HUP 1 exit
|
---|
51 | # INT 2 exit
|
---|
52 | # QUIT 3 core
|
---|
53 | # ILL 4 core
|
---|
54 | # TRAP 5 core
|
---|
55 | # ABRT 6 core
|
---|
56 | # FPE 8 core
|
---|
57 | # KILL 9 exit
|
---|
58 | # SEGV 11 core
|
---|
59 | # PIPE 13 exit
|
---|
60 | # ALRM 14 exit
|
---|
61 | # TERM 15 exit
|
---|
62 |
|
---|
63 | # 0 (User requested exit from the command line)
|
---|
64 | # 1- (Eval options failed, return code of StateMachineImp::Run)
|
---|
65 | # 126 (exit requested from recompile.sh)
|
---|
66 | # 127 (problem with option parsing or no program start, like --help)
|
---|
67 | # 128 (exit(128))
|
---|
68 | # 134 (ABRT, double corruption, abort())
|
---|
69 | # 139 (SEGV, 128+11)
|
---|
70 | # 255 (exception)
|
---|
71 |
|
---|
72 | if [ $RC -eq 126 ]; then
|
---|
73 | continue
|
---|
74 | fi
|
---|
75 |
|
---|
76 | # RC<=128 || RC==KILL || RC=TERM || RC=exception
|
---|
77 | if [ $RC -le 128 ] || [ $RC -eq 137 ] || [ $RC -eq 143 ] || [ $RC -eq 255 ] ]; then
|
---|
78 | exit
|
---|
79 | fi
|
---|
80 |
|
---|
81 | done
|
---|
Note:
See
TracBrowser
for help on using the repository browser.