Skip to content

Instantly share code, notes, and snippets.

@andrewwatts
Created December 29, 2010 22:39
Show Gist options
  • Save andrewwatts/759163 to your computer and use it in GitHub Desktop.
Save andrewwatts/759163 to your computer and use it in GitHub Desktop.
/etc/init.d/hybserv and postinst from hybserv deb package
#! /bin/sh
# hybserv Start/stop Hybserv 2 IRC Services
# Version: hybserv 1.8.0 17-Mar-2003 joshk@triplehelix.org
# Version: hybserv 1.9.2 05-Sep-2006 ag@roxor.cx
### BEGIN INIT INFO
# Provides: hybserv
# Required-Start: $syslog ircd-hybrid
# Required-Stop: $syslog ircd-hybrid
# Should-Start: $local_fs $network $named
# Should-Stop: $local_fs $network $named
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Hybserv daemon init.d script
# Description: Use to manage the Hybserv daemon.
### END INIT INFO
PATH=/sbin:/bin:/usr/sbin:/usr/bin
NAME=hybserv
DAEMON=/usr/local/hybserv/hybserv
PID=/usr/local/hybserv/$NAME.pid
CONF=/usr/local/hybserv/hybserv.conf
DESC="Hybserv 2 IRC Services"
test -f $DAEMON || exit 0
set -e
if [ "$1" = "start" ] || [ "$1" = "restart" ] || [ "$1" = "force-reload" ]; then
if [ ! `grep '#NOT-EDITED#' $CONF | wc -l` -eq 0 ]; then
echo "Not starting $DESC: please edit $CONF first..."
exit 0
fi
fi
case "$1" in
start)
echo -n "Starting $DESC: $NAME"
if [ -f "$PID" ]; then
echo " already running, if this is not the case, then call 'stop' first."
else
start-stop-daemon --start --quiet \
-u irc -c irc --exec $DAEMON >/dev/null 2>&1
fi
echo "."
;;
stop)
echo -n "Stopping $DESC: $NAME"
if [ -f "$PID" ]; then
start-stop-daemon -K -p $PID -s 15 -q --oknodo
rm -f $PID
else
echo " ... not running!" # This is abnormal, please file a bug report.
fi
echo "."
;;
reload)
if [ -f "$PID" ]; then
echo -n "Reloading configuration files for $NAME..."
kill -HUP `cat $PID`
echo "done."
else
echo "Not reloading configuration files for $NAME - not running!"
fi
;;
restart|force-reload)
echo -n "Restarting $DESC: $NAME"
if [ -f "$PID" ]; then
start-stop-daemon -K -p $PID -s 15 -q --oknodo
sleep 1
fi
start-stop-daemon --start --quiet \
-u irc -c irc --exec $DAEMON \
>/dev/null 2>&1
echo "."
;;
*)
echo "Usage: $0 {start|stop|restart|reload|force-reload}" >&2
exit 1
;;
esac
exit 0
#!/bin/sh
set -e
# Show the first time notice
. /usr/share/debconf/confmodule
# Fixing potential fallout from 1.8.0-1...
chown irc:irc /etc/hybserv
db_stop
# Automatically added by dh_installinit
if [ -x "/etc/init.d/hybserv" ]; then
update-rc.d hybserv defaults 21 >/dev/null
if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
invoke-rc.d hybserv start || exit $?
else
/etc/init.d/hybserv start || exit $?
fi
fi
# End automatically added section
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment