aboutsummaryrefslogtreecommitdiffstats
path: root/src/msec/msecperms
blob: ab80b7416b00c3efabf42bbdef3aa620259fae57 (plain)
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
#!/usr/bin/sh
#
# Wrapper for msecperms.py
#

if [ "`whoami`" != "root" ]; then
    echo 'msec: sorry, you must be root !'
    exit 1
fi

LCK=/var/run/msec.pid

function cleanup() {
    rm -f $LCK
}

if [ -f $LCK ]; then
    if [ -d /proc/`cat $LCK` ]; then
    	exit 0
    else
    	rm -f $LCK
    fi
fi

echo -n $$ > $LCK

trap cleanup 0

MSEC=/usr/share/msec/msecperms.py
OPT="$@"

exec $MSEC $OPT

# msec ends here