summaryrefslogtreecommitdiff
path: root/extra/misdnuser/misdncapid.rc
blob: 5c47ca0a9a8727034ade6d9fd27ec92df4e2681a (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
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash

# general config
. /etc/rc.conf
. /etc/rc.d/functions

PID="$(pidof -o %PPID /usr/sbin/mISDNcapid)"
case "$1" in
    start)
        stat_busy "Starting misdncapid"
	if [ ! -x /var/run/mISDNcapid ] ; then
	    install -m755 -d /var/run/mISDNcapid
	fi

	[ -z "$PID" ] && /usr/sbin/mISDNcapid >/dev/null 2>&1
        if [ $? -gt 0 ]; then
            stat_fail
        else
            PID=$(pidof -o %PPID /usr/sbin/mISDNcapid)
            echo $PID > /var/run/misdncapid.pid
            add_daemon misdncapid
            stat_done
        fi
        ;;
    stop)
        stat_busy "Stopping misdncapid"
	[ -f /var/run/misdncapid.pid ] && kill `cat /var/run/misdncapid.pid` >/dev/null 2>&1
        if [ $? -gt 0 ]; then
            stat_fail
        else
	    rm -f /var/run/misdncapid.pid
            rm_daemon misdncapid
            stat_done
        fi
        ;;
    restart)
        $0 stop
	sleep 1
        $0 start
        ;;
    *)
        echo "usage: $0 {start|stop|restart}"
	;;
esac
exit 0