#!/bin/sh ### BEGIN INIT INFO # Provides: mangosd # Required-Start: $local_fs $remote_fs $network $syslog $named # Required-Stop: $local_fs $remote_fs $network $syslog $named # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # X-Interactive: false # Short-Description: mangosd service ### END INIT INFO #mangosd service MANGOS_USER="mangos" DAEMON=bin/mangosd start() { echo "Starting mangosd..." HOMEDIR=`getent passwd $MANGOS_USER | cut -d: -f6` if [ -x $HOMEDIR/$DAEMON ]; then HOME="$HOMEDIR" start-stop-daemon --start -c $MANGOS_USER --pidfile $HOMEDIR/bin/mangosd.pid --make-pidfile --exec $HOMEDIR/bin/mangosd -d $HOMEDIR/bin --background -- -c $HOMEDIR/etc/mangosd.conf fi } stop() { echo "Stopping mangosd..." HOMEDIR=`getent passwd $MANGOS_USER | cut -d: -f6` if [ -x $HOMEDIR/$DAEMON ]; then start-stop-daemon -o -c $MANGOS_USER -K -u $MANGOS_USER -x $HOMEDIR/$DAEMON fi } status() { dbpid=`pgrep -u $MANGOS_USER mangosd` if [ -z $dbpid ] ; then echo "mangosd for USER $MANGOS_USER: not running." else echo "mangosd for USER $MANGOS_USER: running (pid $dbpid)" fi } case "$1" in start) start ;; stop) stop ;; restart|reload|force-reload) stop start ;; status) status ;; *) echo "Usage: /etc/init.d/mangosd {start|stop|reload|force-reload|restart|status}" exit 1 esac exit 0