metronome-init 1.26 KB
Newer Older
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
#! /bin/sh
#
# metronome        Start/stop metronome server
#

### BEGIN INIT INFO
# Provides:          metronome
# Required-Start:    $remote_fs $network $named $time
# Required-Stop:     $remote_fs $network $named $time
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Starts metronome server
# Description:       Starts metronome server, an XMPP server written in Lua.
### END INIT INFO

METRONOME=/usr/bin/metronomectl
PIDDIR=/var/run/metronome
NAME=metronome

test -e $METRONOME || exit 0

start()
{
        mkdir $PIDDIR -p
        chown metronome:metronome $PIDDIR
        chmod 750 $PIDDIR

    $METRONOME start >> /dev/null
}

stop()
{
    $METRONOME stop >> /dev/null
}

36 37
reload()
{
38
    $METRONOME reload >> /dev/null
39 40 41 42
}

restart()
{
43
    $METRONOME restart >> /dev/null
44 45
}

46 47 48 49 50 51 52 53 54
case "$1" in
    start)
        echo -n "Starting Metronome..."
        start &
    ;;
    stop)
        echo -n "Stopping Metronome..."
        stop &
    ;;
55 56 57 58
    reload)
        echo -n "Reloading Metronome config..."
        reload &
    ;;
59 60
    restart)
        echo -n "Restarting Metronome..."
61
        restart &
62 63
    ;;
    *)
64
        echo "Usage: $0 {start|stop|reload|restart}" >&2
65 66 67 68 69 70 71 72 73 74 75
        exit 1
    ;;
esac

if [ $? -eq 0 ]; then
    echo .
else
    echo " failed!"
fi

exit 0