aboutsummaryrefslogtreecommitdiffstats
path: root/src/msec/msec
blob: c90bd829ad30e01df2486860b382f0a6e69c5988 (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
#!/bin/sh
#
# Wrapper for msec.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/msec.py
OPT="$@"

exec $MSEC $OPT

# msec ends here