Article View: news.software.nntp
Article #26564Re: Proper way to shutdown INN
From: Jeff Makey
Date: Fri, 27 Feb 1998 00:00
Date: Fri, 27 Feb 1998 00:00
87 lines
2907 bytes
2907 bytes
Below is the /etc/init.d/news script I use on my Solaris news server.
It is run as root and does an excellent job of cleanly starting and
stopping INN. It requires this patch:
*** inn-1.5.1/samples/rc.news.~1~ Tue Dec 17 06:40:40 1996
--- inn-1.5.1/samples/rc.news Thu Jun 26 20:23:26 1997
***************
*** 68,74 ****
# Gee, looks like lisp, doesn't it?
${DOINNWATCH} && {
! ( sleep 60 ; ${INNWATCH} ) &
}
RMFILE=${MOST_LOGS}/expire.rm
--- 68,74 ----
# Gee, looks like lisp, doesn't it?
${DOINNWATCH} && {
! echo "( sleep 60 ; ${INNWATCH} ) &" | su ${NEWSUSER}
}
RMFILE=${MOST_LOGS}/expire.rm
-----------------------------------------------------------------
#!/sbin/sh
#
# /etc/init.d/news - Start/Stop the Usenet news system
#
HOME=`csh -cf 'echo ~news'`
if [ -z "$HOME" ] ; then
exit 0 # news account does not exist
fi
if [ ! -r $HOME/etc/innshellvars ] ; then
exit 0 # INN not installed in a known place
fi
. $HOME/etc/innshellvars
case $1 in
start)
if [ -x $NEWSBIN/rc.news ] ; then
# establish a clean environment when run by hand
cd /
env - TZ=$TZ PATH=/usr/bin:/usr/ucb:/usr/sbin $NEWSBIN/rc.news
fi
;;
stop)
if [ -r $WATCHPID ] ; then
pid="`cat $WATCHPID`"
# kill the innwatch shell script
kill $pid
pid="`ps -u news -o ppid,pid | sed -e \"/^ *$pid /!d\" -e \"s/.* //\"`"
# then kill any child processes of innwatch
if [ "$pid" ] ; then
kill $pid
fi
fi
if [ -p $NEWSCONTROL ] ; then
ctlinnd -s throttle "Preparing to shut down."
ctlinnd -s readers no "Preparing to shut down."
sleep 5
ctlinnd -s shutdown "as requested in $0"
fi
;;
*)
echo "usage: $0 {start|stop}"
;;
esac
-----------------------------------------------------------------
Note that it completely bypasses innstart, which no longer needs to be
setuid. Throttling and disabling readers 5 seconds before the
shutdown might not be necessary, but it gives everyone a fair chance
to cleanly close their connections. This does not kill nnrpd
processes.
:: Jeff Makey
jeff@sdsc.edu
Department of Tautological Pleonasms and Superfluous Redundancies Department
Technical Details
Message-ID:
<6d5av6$nl4@rosebud.sdsc.edu>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mailReferences:
<34F1C6EF.CA27E49B@library.rider.edu>Show Full Headers
Complete Article Headers
Message-ID: <6d5av6$nl4@rosebud.sdsc.edu> Subject: Re: Proper way to shutdown INN Date: Fri, 27 Feb 1998 00:00:00 +0000 From: jeff@sdsc.edu (Jeff Makey) References: <34F1C6EF.CA27E49B@library.rider.edu> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail X-Deja-AN: 329051860 Originator: jeff@rosebud.sdsc.edu Distribution: inet Organization: San Diego Supercomputer Center, San Diego, California Newsgroups: news.software.nntp