tags 551501 + patch thanks Here is an initscript you can use, it works pretty well for me.
micah
#!/bin/sh
#
### BEGIN INIT INFO
# Provides: rbot
# Should-Start: $network
# Should-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: ruby irc bot
# Description: ruby irc bot
### END INIT INFO
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/rbot
NAME=rbot
DESC="ruby irc bot"
USER=rbot
PIDFILE=/var/run/$NAME.pid
test -x $DAEMON || exit 0
. /lib/lsb/init-functions
# Default options, these can be overriden by the information
# at /etc/default/$NAME
DAEMON_OPTS=""
# Include defaults if available
if [ -f /etc/default/$NAME ] ; then
. /etc/default/$NAME
fi
# Check that the user exists (if we set a user)
# Does the user exist?
if [ -n "$USER" ] ; then
if getent passwd | grep -q "^$USER:"; then
# Obtain the uid and gid
DAEMONUID=`getent passwd |grep "^$USER:" | awk -F : '{print $3}'`
DAEMONGID=`getent passwd |grep "^$USER:" | awk -F : '{print $4}'`
else
log_failure_msg "The user $USER, required to run $NAME does not exist."
exit 1
fi
fi
set -e
case "$1" in
start)
log_daemon_msg "Starting $DESC " "$NAME"
if start-stop-daemon --user $USER --start --quiet --pidfile $PIDFILE
--background \
--make-pidfile -c $DAEMONUID:$DAEMONGID --startas $DAEMON --
$DAEMON_OPTS; then
log_end_msg 0
else
log_end_msg 1
fi
;;
stop)
log_daemon_msg "Stopping $DESC" "$NAME"
if start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE --user
$USER --startas $DAEMON; then
log_end_msg 0
else
log_end_msg 1
fi
;;
restart|force-reload)
log_daemon_msg "Restarting $DESC" "$NAME"
start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile $PIDFILE
--user $USER --startas $DAEMON
if start-stop-daemon --user $USER --start --quiet --pidfile $PIDFILE
--background \
--make-pidfile -c $DAEMONUID:$DAEMONUID --startas $DAEMON --
$DAEMON_OPTS; then
log_end_msg 0
else
log_end_msg 1
fi
;;
status)
status_of_proc -p $PIDFILE $DAEMON $NAME
;;
reload)
log_daemon_msg "Reloading $DESC" "$NAME"
if start-stop-daemon --stop --signal 1 --quiet --oknodo --pidfile
$PIDFILE --startas $DAEMON; then
log_end_msg 0
else
log_end_msg 1
fi
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|force-stop|restart|force-reload|status}" >&2
exit 1
;;
esac
exit 0
signature.asc
Description: Digital signature

