summaryrefslogtreecommitdiff
path: root/pkg/leap_mx
blob: 0b50426e29da5fdb0ae08210cf88f02457cfe19a (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
49
50
51
#!/bin/sh

PATH=/sbin:/bin:/usr/sbin:/usr/bin

pidfile=/var/run/leap_mx.pid \
rundir=/var/lib/leap_mx/ \
file=/usr/local/bin/mx.tac \
logfile=/var/log/leap_mx.log

[ -r /etc/default/leap_mx ] && . /etc/default/leap_mx

test -x /usr/bin/twistd || exit 0
test -r $file || exit 0
test -r /etc/leap/ || exit 0


case "$1" in
    start)
        echo -n "Starting leap_mx: twistd"
        HOME="/var/lib/leap_mx/" \
          start-stop-daemon --start --quiet --exec /usr/bin/twistd -- \
                          --pidfile=$pidfile \
                          --rundir=$rundir \
                          --python=$file \
                          --logfile=$logfile
        echo "."
    ;;

    stop)
        echo -n "Stopping leap_mx: twistd"
        start-stop-daemon --stop --quiet  \
            --pidfile $pidfile
        echo "."
    ;;

    restart)
        $0 stop
        $0 start
    ;;

    force-reload)
        $0 restart
    ;;

    *)
        echo "Usage: /etc/init.d/leap_mx {start|stop|restart|force-reload}" >&2
        exit 1
    ;;
esac

exit 0