summaryrefslogtreecommitdiff
path: root/pkg/leap_mx
blob: a5c7438c13b094a33c99923a1cfd47e2b69b222e (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 -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/local/bin/twistd -- \
                          --pidfile=$pidfile \
                          --rundir=$rundir \
                          --python=$file \
                          --logfile=$logfile \
                          --syslog --prefix=leap-mx
        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