Debian Codegraph @

etc/run_sigcleave

raw
1 #!/bin/sh -
2
3 # this script will run a search program on a sequence input file or on each
4 # file in a file of filenames
5
6 # to customise this script see the function called run_one_prog below
7
8
9 ROG=sigcleave
10
11
12 if [ $# = 4 -a x$1 = x-onefile ]
13 then
14 shift
15 ONEFILE=t
16 MINWEIGHT=$3
17 else
18 if [ $# = 2 ]
19 then
20 MINWEIGHT=$2
21 else
22 echo usage: $0 -onefile input_file output_file minimum_weight 1>&2
23 echo or: $0 file_of_filenames minimum_weight 1>&2
24 exit 1
25 fi
26 fi
27
28 PARAMETERS="-minweight $MINWEIGHT"
29
30 ### change this function to suit your site:
31
32 run_one_prog () {
33 INPUT_FILE=$1
34 OUTPUT_FILE=$2
35 PARAMETERS="$3 $4 $5 $6 $7 $8 $9"
36
37 ### change these lines:
38 EXEC=sigcleave
39
40 COMMAND="$EXEC $INPUT_FILE -outfile $OUTPUT_FILE $PARAMETERS"
41
42 echo
43 echo "input file: $INPUT_FILE"
44 echo "output will be written to: $OUTPUT_FILE"
45 echo "executing command: $COMMAND" 1>&2
46
47 # add/change the flags to suit your site:
48 $COMMAND 2>&1 | tee ${PROG}_errors.new 1>&2
49
50 #### end of changes
51
52
53 if [ -s ${PROG}_errors.new ]
54 then
55 ( echo ERROR running $PROG: ; echo;
56 echo ===================================================
57 cat ${PROG}_errors.new ) >> $OUTPUT_FILE
58 cat ${PROG}_errors.new >> ${PROG}_errors
59 fi
60 }
61
62 (echo "#!/bin/sh -"; echo "kill $$") > $PROG.kill
63
64 chmod a+x $PROG.kill
65
66 if [ x$ONEFILE = x ]
67 then
68 for i in `cat $1`
69 do
70 run_one_prog $i $i.out $PARAMETERS
71 done
72
73 else
74 run_one_prog $1 $2 $PARAMETERS
75 fi
76
77 exit 0