summaryrefslogtreecommitdiffabout
path: root/tests/aux/respawn
blob: afed85b88cfe2341112840f31fe9da4bb8ea58b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#! /bin/sh

# usage: respawn FILE COUNT 

file=${1:?}
maxcount=${2:?}

count=0

if [ -f $file ]; then
    count=`cat $file`
    if test -n "$count" && test $count -ge $maxcount; then
       exit 1
    fi
fi

count=$(($count + 1))
echo "$count" > $file

exit 0

       

Return to:

Send suggestions and report system problems to the System administrator.