File: stealthcron

package info (click to toggle)
stealth 4.04.00-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,540 kB
  • sloc: cpp: 2,759; sh: 151; makefile: 111; ansic: 52
file content (53 lines) | stat: -rwxr-xr-x 1,183 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash

PROG=`basename $0`
STEALTH=/usr/bin/stealth

testAbsolute()
{
    echo $1 | grep "^/" > /dev/null 2>&1 && return

    echo "\`$1' must be absolute path"
    exit 1
}

case $# in
    (2|3)
        testAbsolute $1
        testAbsolute $2
        if [ "$3" != "" ]
        then
            testAbsolute $3
            SKIP="-s $3"
        fi

        if [ -x ${STEALTH} ] ; then
            ${STEALTH} --ping $1
            if [ $? -ne 0 ] ; then
		/usr/bin/logger -t STEALTHCRON -p daemon.warning -- \
			restarting stealth --daemon $1 ...
		rm -f $1
		${STEALTH} --daemon $1 ${SKIP}  $2
	    fi
        fi
    ;;
            
    (*)
    echo "
$PROG by Frank B. Brokken (f.b.brokken@rug.nl)
Usage: $PROG uds policyfile [skipfile]
where:
    uds:        absolute path to the Unix Domain Socket to be used
    policyfile: absolute path to the policyfile to be used
    skipfile:   absolute path to the skipfile to be used (optional)

    calls $STEALTH} --ping uds. 
    If that fails, 
        ${STEALTH} --daemon uds policyfile
    or (if skipfile was specified)
        ${STEALTH} --daemon uds policyfile -s skipfile policyfile
    is started.
"
    exit 1
    ;;
esac