Talk:Installing Mumble

From Mumble Wiki
Revision as of 13:24, 5 August 2009 by Wobak (talk | contribs)
Jump to: navigation, search

Init.d startup/ stop script

Hi,

I wrote a startup script for Mumble under Linux, which is, I think, quite enough.

Feel free to add it on the page / enhance it...


---- #!/bin/bash # # description: Murmur Service # Idologic Jun 27, 2007 # Get function from functions library #. /lib/lsb/init-functions #Variables #Pid File : change to your own if needed PIDFILE=/var/run/murmur.pid #Binary file : change to your full path to murmur.x86 BINFILE=/usr/local/bin/murmur #ini file : path to your murmur.ini config file INIFILE=/etc/murmur/murmur.ini # Start the service Murmur readrunning() { ISRUNNING=0 if [ ! -e $PIDFILE ] ; then pspid=$(pidof murmur) if [ "$pspid" = "" ] ; then PID="" echo -e "Server not running.\n" ISRUNNING=0 else PID=$pspid ISRUNNING=1 fi else PID=$(cat /var/run/murmur.pid) pspid=$(pidof murmur) if [ "$pspid" != "$PID" ] ; then PID="" echo -e "Server not running but $PIDFILE exists...\n" echo -e "Please delete it manually before going on." ISRUNNING=0 else ISRUNNING=1 fi fi if [ $ISRUNNING = 1 ] ; then echo -e "Server running with pid : $PID" fi } start() { echo -n $"Starting Murmur server: " if [ $ISRUNNING = 1 ] ; then echo "Error : Server already running with PID : $PID" else $BINFILE -ini $INIFILE sleep 1 pidof murmur > $PIDFILE echo -e "\n" fi } # Restart the service Murmur stop() { echo -n $"Stopping Murmur server: " if [ $ISRUNNING = 0 ] ; then echo "Error : Server not running..." else kill -9 $PID rm $PIDFILE echo -e "Server Murmur stopped.\n" fi } ### main logic ### case "$1" in start) readrunning start ;; stop) readrunning stop ;; status) readrunning ;; restart|reload|condrestart) readrunning stop sleep 3 start ;; *) echo $"Usage: $0 {start|stop|restart|reload|status}" exit 1 esac exit 0