Skip to content

Instantly share code, notes, and snippets.

@SegFaultAX
Created March 29, 2012 17:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save SegFaultAX/2240921 to your computer and use it in GitHub Desktop.
Save SegFaultAX/2240921 to your computer and use it in GitHub Desktop.
/etc/init.d/ircd
#! /bin/sh
### BEGIN INIT INFO
# Provides: ircd
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the charybdis ircd
# Description: starts charybdis using start-stop-daemon
### END INIT INFO
PATH=/home/ircd/ircd/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/home/ircd/ircd/bin/ircd
PIDFILE=/home/ircd/ircd/etc/ircd.pid
USER=ircd
NAME=ircd
DESC=ircd
test -x $DAEMON || exit 0
case "$1" in
start)
echo -n "Starting $DESC: "
start-stop-daemon --start --quiet --user $USER --pidfile $PIDFILE \
--exec $DAEMON -- $DAEMON_OPTS
echo "$NAME."
;;
stop)
echo -n "Stopping $DESC: "
start-stop-daemon --stop --quiet --user $USER --pidfile $PIDFILE \
--exec $DAEMON
echo "$NAME."
;;
restart|force-reload)
echo -n "Restarting $DESC: "
# Shutdown
start-stop-daemon --stop --quiet --user $USER --pidfile $PIDFILE \
--exec $DAEMON
sleep 1
# Startup
start-stop-daemon --start --quiet --user $USER --pidfile $PIDFILE \
--exec $DAEMON -- $DAEMON_OPTS
echo "$NAME."
;;
reload)
echo -n "Reloading $DESC configuration: "
start-stop-daemon --stop --signal HUP --quiet --pidfile $PIDFILE \
--user $USER --exec $DAEMON
echo "$NAME."
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
exit 1
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment