Talk:Installing Mumble

From Mumble Wiki
Revision as of 13:22, 5 August 2009 by Wobak (talk | contribs) (Init.d startup/ stop script)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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...



  1. !/bin/bash
  2. description: Murmur Service
  3. Idologic Jun 27, 2007
  1. Get function from functions library
  2. . /lib/lsb/init-functions
  1. Variables
  2. Pid File : change to your own if needed

PIDFILE=/var/run/murmur.pid

  1. Binary file : change to your full path to murmur.x86

BINFILE=/usr/local/bin/murmur

  1. ini file : path to your murmur.ini config file

INIFILE=/etc/murmur/murmur.ini

  1. 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 }

  1. 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 }

      1. 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