[LINUX] murmur Startscript

Ice/DBus, Web-Interfaces, Management tools

[LINUX] murmur Startscript

Postby lux73 » Sun Feb 14, 2010 11:41 am

Hi all!

i have wrote a small & basic start-stop script for murmur server under Linux - tested on Debian lenny 5.0 64bit - it should work on all other Linux systems

place it under /etc/init.d/murmurd - make sure you have executable rights

chmod 755 /etc/init.d/murmurd

it has 4 basic commands:

/etc/init.d/murmurd start- to start the server

/etc/init.d/murmurd stop - to stop it

/etc/init.d/murmurd restart - for restart

/etc/init.d/murmurd status - status information

you need only to edit the configuration part:

Code: Select all
################ CONFIGURATION START ##############################

# description
DESC="murmur-Server"

# running murmurd as specific user
USER=murmurd

# path to the working directory
DIR=/srv/murmur1.2.2

# name of the config file
INI=murmur.ini

# binary name
BIN=murmur.x86

################ CONFIGURATION END ################################


it should be self explained... ;)

here's the whole script:

Code: Select all
#! /bin/sh
#
# Basic Murmur Startscript by lux73
#
# v1.0 13.02.2010
#
#

################ CONFIGURATION START ##############################

# description
DESC="murmur-Server"

# running murmurd as specific user
USER=murmurd

# path to the working directory
DIR=/srv/murmur1.2.2

# name of the config file
INI=murmur.ini

# binary name
BIN=murmur.x86

################ CONFIGURATION END ################################
 
PARAMS="-ini $DIR/$INI"

case "$1" in
start)
          echo "trying to start $DESC..."
          if [ $(pidof $BIN) ]
     then
             echo "$DESC is ALREADY running! ABORT!"
             exit 1
     else
                  su $USER -c "cd $DIR; ./$BIN $PARAMS"
                  sleep 1
                  echo "===> $DESC started succesfully!!"
                  exit 0
          fi
          ;;

stop)
          echo "trying to stop $DESC..."
          if [ ! $(pidof $BIN) ]
          then
                  echo "$DESC is even NOT running! ABORT!"
                  exit 1
          else
                  kill $(pidof $BIN)
                  sleep 1
                  echo "===> $DESC stopped succesfully!!"
                  exit 0
          fi
          ;;

restart)
     $0 stop
     sleep 1
     $0 start
     exit 0
     ;;

status)
          echo "Running Process from $DESC:"
          if [ ! $(pidof $BIN) ]
          then
                   echo "===> no active process found! <==="
                   exit 0
          else
                   ps -lC $BIN --no-heading
          fi
          ;;

*)
          echo "Usage: /etc/init.d/murmurd start|stop|restart|status"
          exit 1
          ;;
esac


have fun with it! :mrgreen:

greetings from Germany

Lux
lux73
 
Posts: 6
Joined: Tue Feb 09, 2010 4:59 pm
Location: Germany

Re: [LINUX] murmur Startscript

Postby jesepi » Tue Mar 09, 2010 11:25 am

I'm getting the following when attemping to use this on Centos 5.4

Code: Select all
/etc/init.d/murmurd: line 68: pidof: command not found


How can I fix this?
jesepi
 
Posts: 12
Joined: Fri Mar 05, 2010 3:29 pm

Re: [LINUX] murmur Startscript

Postby rawnar » Tue Mar 09, 2010 12:49 pm

One can also use the init.d script provided in the source tar archive of mumble. In the subdirectory 'scripts' you can find the file murmur.init which can be copied to the /etc/init.d (or corresponding directory depending on your distribution). You also may need to at a file called 'mumble-server' in /etc/defaults containing the lines:
Code: Select all
MURMUR_DAEMON_START=1
MURMUR_USE_CAPABILITIES=0
This script also expects the file 'mumble-server.ini' in /etc, an example of this file can also be found in the scripts subdirectory of the mumble source tar archive.

Hopefully it helps.
Computer specs: AMD FX-8320, 8GB DDR3-SDRAM, AMD Radeon HD 7950, Asus Xonar D1, Windows 7 Ultimate 64bit/Debian Jessie AMD64.
rawnar
 
Posts: 243
Joined: Tue Mar 09, 2010 8:54 am
Location: Borne, the Netherlands

Re: [LINUX] murmur Startscript

Postby lux73 » Thu Mar 11, 2010 4:43 pm

jesepi wrote:I'm getting the following when attemping to use this on Centos 5.4

Code: Select all
/etc/init.d/murmurd: line 68: pidof: command not found


How can I fix this?

Hi!

try to replace

Code: Select all
if [ $(pidof $BIN) ]


with

Code: Select all
if [ $(/sbin/pidof $BIN) ]


in my Script - must replace 3 times

seems to be CentOS specific - google say: "pidof" command is located in "/sbin" and default PATH for centos doesn't include "/sbin" as its path

good luck! ;)
lux73
 
Posts: 6
Joined: Tue Feb 09, 2010 4:59 pm
Location: Germany


Return to Scripting

Who is online

Users browsing this forum: No registered users and 2 guests