#!/bin/sh ### BEGIN INIT INFO # Provides: realmd # 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: realmd service ### END INIT INFO #realmd service MANGOS_USER="mangos" DAEMON=bin/realmd start() { echo "Starting realmd..." 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/realmd.pid --make-pidfile --exec $HOMEDIR/bin/realmd -d $HOMEDIR/bin --background -- -c $HOMEDIR/etc/realmd.conf fi } stop() { echo "Stopping realmd..." 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 realmd` if [ -z $dbpid ] ; then echo "realmd for USER $MANGOS_USER: not running." else echo "realmd 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/realmd {start|stop|reload|force-reload|restart|status}" exit 1 esac exit 0