summaryrefslogtreecommitdiff
blob: 24aa37b97f695b0a1454cdb31ea664fd5c49e85e (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
46
47
48
#!/sbin/runscript
#
# NetworkManagerDispatcher:   NetworkManagerDispatcher daemon
#
# chkconfig: 345 98 02
# description:  This is a daemon for automatically executing certain
#               actions, when switching networks
#
# processname: NetworkManagerDispatcher
# pidfile: /var/run/NetworkManagerDispatcher.pid

prefix=/usr
exec_prefix=/usr
sbindir=${exec_prefix}/sbin

NETWORKMANAGERDISPATCHER_BIN=${sbindir}/NetworkManagerDispatcher

# Sanity checks.
[ -x $NETWORKMANAGERDISPATCHER_BIN ] || exit 0

# so we can rearrange this easily
processname=$NETWORKMANAGERDISPATCHER_BIN
pidfile=/var/run/NetworkManagerDispatcher.pid

depend() {
        need NetworkManager
}

start()
{
        if [ -e ${pidfile} ]; then
                rm -f ${pidfile}
        fi
        ebegin "Starting NetworkManagerDispatcher"
        start-stop-daemon --start --quiet --exec ${processname}
        eend $?
        echo $(/bin/pidof NetworkManagerDispatcher) > ${pidfile}
}

stop()
{
        ebegin "Stopping NetworkManagerDispatcher"
        start-stop-daemon --stop --quiet --exec ${processname} --pidfile ${pidfile}
        eend $?
        if [ -e ${pidfile} ]; then
                rm -f $pidfile
        fi
}