summaryrefslogtreecommitdiff
path: root/openwrt/rhctl/files/switchctl.init
blob: 8ebe46f2a3b77cbddbbfbeabf681ac98f8092e27 (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
#!/bin/sh /etc/rc.common
START=70

BIN=switchctl
DAEMON=/usr/bin/$BIN
DESC=$BIN
RUN_D=/var/run/rhctl
PIDFILE=$RUN_D/$BIN.pid

start() {
    echo -n "Starting $DESC:"
    mkdir -p $RUN_D
    $DAEMON --write-pid $PIDFILE
    if [ $? -ne 0 ]; then
        echo -n " Error"
    else 
        echo -n " Ok"
    fi
    echo "."
}

stop() {
    echo -n "Stopping $DESC:"
    if [ -f $PIDFILE ]; then
        kill `cat $PIDFILE` > /dev/null 2>&1
        rm -f $PIDFILE > /dev/null 2>&1
        echo -n " Ok"
    else
        echo -n " not running"
    fi
    echo "."
}