Created
December 29, 2010 00:25
-
-
Save andrewwatts/757953 to your computer and use it in GitHub Desktop.
/etc/init.d/ircd-hybrid, /etc/default/ircd-hybrid, /etc/logrotate.d/ircd-hybrid and postinst form ircd-hybrid deb package
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Start ircd-hybrid when invoked via init.d shell script. | |
START=yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
# ircd-hybrid Start/stop the Hybrid 7 IRC server. | |
# Version: ircd-hybrid 7.0rc9-1 03-Mar-2003 [email protected] | |
# Version: ircd-hybrid 7.2.2-2 10-Sep-2006 [email protected] | |
### BEGIN INIT INFO | |
# Provides: ircd-hybrid | |
# Required-Start: $syslog | |
# Required-Stop: $syslog | |
# 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: IRCd-Hybrid daemon init.d script | |
# Description: Use to manage the IRCd-Hybrid daemon. | |
### END INIT INFO | |
PATH=/sbin:/bin:/usr/sbin:/usr/bin | |
DAEMON=/usr/local/ircd-hybrid/bin/ircd | |
DEFAULT=/etc/default/ircd-hybrid | |
NAME=ircd | |
PID_DIR=/usr/local/ircd-hybrid/etc | |
PID=$PID_DIR/$NAME.pid | |
DESC="Hybrid 7 IRC Server" | |
test -f $DAEMON || exit 0 | |
if [ -f $DEFAULT ] | |
then | |
. $DEFAULT | |
fi | |
set -e | |
case "$1" in | |
start) | |
if [ "$START" = "yes" ] | |
then | |
echo -n "Starting $DESC: $NAME" | |
mkdir -p -m 755 $PID_DIR | |
chown irc:irc $PID_DIR | |
start-stop-daemon --start --quiet \ | |
-u irc -c irc --exec $DAEMON -- -pidfile $PID \ | |
> /dev/null | |
echo "." | |
fi | |
;; | |
stop) | |
if [ "$START" = "yes" ] | |
then | |
echo -n "Stopping $DESC: $NAME" | |
start-stop-daemon --oknodo --stop --quiet \ | |
--pidfile $PID \ | |
--signal 15 --exec $DAEMON -- -pidfile $PID | |
echo "." | |
fi | |
;; | |
reload) | |
if [ "$START" = "yes" ] | |
then | |
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 | |
fi | |
;; | |
restart|force-reload) | |
if [ "$START" = "yes" ] | |
then | |
echo -n "Restarting $DESC: $NAME" | |
if [ -f "$PID" ]; then | |
start-stop-daemon --stop --quiet --pidfile \ | |
$PID --signal 15 \ | |
--exec $DAEMON -- -pidfile $PID | |
sleep 1 | |
fi | |
mkdir -p -m 755 $PID_DIR | |
chown irc:irc $PID_DIR | |
start-stop-daemon --start --quiet \ | |
-u irc -c irc --exec $DAEMON -- -pidfile $PID \ | |
> /dev/null | |
echo "." | |
fi | |
;; | |
*) | |
echo "Usage: $0 {start|stop|restart|reload|force-reload}" >&2 | |
exit 1 | |
;; | |
esac | |
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ircd-hybrid log rotation | |
/var/log/ircd/ircd-hybrid.log { | |
rotate 3 | |
weekly | |
compress | |
delaycompress | |
postrotate | |
invoke-rc.d ircd-hybrid reload > /dev/null | |
endscript | |
missingok | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
. /usr/share/debconf/confmodule | |
# Automatically added by dh_installinit, edited for use with debconf | |
# Not added anymore due to dh_installinit -n, so we manage it manually. | |
if [ -x "/etc/init.d/ircd-hybrid" ]; then | |
update-rc.d ircd-hybrid defaults >/dev/null | |
if [ "$1" = "configure" ]; then | |
if dpkg --compare-versions "$2" le "1:7.2.2-1"; then | |
RET="true" | |
else | |
if [ -e /usr/share/debconf/confmodule ]; then | |
. /usr/share/debconf/confmodule | |
db_get ircd-hybrid/restart_on_upgrade | |
db_stop | |
else | |
RET="true" | |
fi | |
fi | |
fi | |
fi | |
# End automatically added section | |
if [ "$1" = configure ]; then | |
# These directories may have been created before, but we need to make them | |
# owned by irc. Or the initscript will get owned. If it's already this | |
# way, this operation makes no difference. | |
chown irc:irc /var/log/ircd /etc/ircd-hybrid | |
chmod 770 /etc/ircd-hybrid | |
if [ "$RET" = "true" ]; then | |
invoke-rc.d ircd-hybrid start || exit $? | |
else | |
echo "I have not stopped or restarted the ircd-hybrid daemon." | |
echo "You should do this yourself whenever you're ready." | |
echo "Type \`\`invoke-rc.d ircd-hybrid restart''." | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment