This script was used on Debian Squeeze 6.0.6!

System V

realmd
#!/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

System D

realmd.service
[Unit]
Description=MaNGoS Zero Realm Server
Requires=network.target local-fs.target remote-fs.target mariadb.service
After=network.target local-fs.target remote-fs.target mariadb.service
 
[Install]
WantedBy=multi-user.target
 
[Service]
# Configuration
Environment=WORKING_DIRECTORY="/opt/mangos0/"
Environment=TMUX_SESSION_NAME="realm0"
# Internals
Type=simple
KillMode=mixed
TimeoutStopSec=60
User=mangos0
ExecStart=/usr/bin/tmux new-session -d -c "$WORKING_DIRECTORY" -s "$TMUX_SESSION_NAME" -n "$TMUX_SESSION_NAME" /opt/mangos0/bin/realmd -c /opt/mangos0/etc/realmd.conf
ExecStop=/usr/bin/tmux send-keys -t "$TMUX_SESSION_NAME" C-c
RemainAfterExit=yes