IT/Script d'init pour Murmur

29 janvier 2020 Rédigé par Linuxine

Un petit script à mettre dans init.d pour pouvoir lancer Murmur comme un service :
### BEGIN INIT INFO
# Provides:          murmur
# Required-Start:    $local_fs $remote_fs $network
# Required-Stop:     $local_fs $remote_fs $network
# Short description: Start/Stop Murmur, the voice chat server
### END INIT INFO

# chkconfig: 2345 55 25

pidfile=/var/run/murmur/murmur.pid
pid=`/bin/cat /var/run/murmur/murmur.pid`

case "$1" in
    start)
        if [ ! "$pid" ]; then
            /bin/echo "Starting Murmur ... "
            /opt/mumble/murmur.x86
        fi
        exit 0
    ;;
    stop)
        if [ "$pid" ]; then
            /bin/echo "Shutting down Murmur ... "
            /bin/kill -9 $pid
            :> $pidfile 
        fi
        exit 0
    ;;
    status)
        /bin/echo -n "Murmur is "
        if [ "$pid" ]; then
            /bin/echo "running."
            exit 0
        else
            /bin/echo "not running!"
            exit 1
        fi
    ;;
    restart|reload|force-reload)
        $0 stop
        $0 start
    ;;
    *)
        echo "Usage: $0 {start|stop|status|restart|reload|force-reload}" >&2
        exit 1
    ;;
esac

Les commentaires sont fermés.