/usr/lib/news/bin/rc.news is in inn2 2.6.0-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | #! /bin/bash
. /usr/lib/news/innshellvars
## $Revision: 9723 $
## News boot script. Runs as "news" user. Run from rc.whatever as:
## su news -s /bin/sh -c /path/to/rc.news >/dev/console
##
## Or to stop INN:
## su news -s /bin/sh -c '/path/to/rc.news stop'
waitforpid()
{
i=12
while [ $i -gt 0 ];
do
kill -0 $1 2>/dev/null || break
sleep 5
printf "."
i=`expr $i - 1`
done
printf "\n"
}
case X"$1" in
Xstop)
# Stop cnfsstat (if running)
if [ -f ${PATHRUN}/cnfsstat.pid ]; then
kill `cat ${PATHRUN}/cnfsstat.pid`
rm -f ${PATHRUN}/cnfsstat.pid
fi
# Stop innwatch (if running)
if [ -f $WATCHPID ]; then
kill `cat $WATCHPID`
rm -f $WATCHPID ${LOCKS}/LOCK.innwatch
fi
printf "Stopping innd: "
${PATHBIN}/ctlinnd shutdown 'rc.news stop'
# Wait for innd to exit (up to 60 sec)
pid=`cat ${SERVERPID} 2>/dev/null`
if [ "$pid" != "" ]; then
waitforpid $pid
else
printf "\n"
fi
# Turn off ovdb support procs, and close the DB environment
if [ "$OVMETHOD" = "ovdb" -a -f ${PATHRUN}/ovdb_server.pid ]; then
pid=`cat ${PATHRUN}/ovdb_server.pid 2>/dev/null`
if [ "$pid" != "" ]; then
printf "Stopping ovdb_server: "
kill $pid
waitforpid $pid
fi
fi
if [ "$OVMETHOD" = "ovdb" -a -f ${PATHRUN}/ovdb_monitor.pid ]; then
pid=`cat ${PATHRUN}/ovdb_monitor.pid 2>/dev/null`
if [ "$pid" != "" ]; then
printf "Stopping ovdb_monitor: "
kill $pid
waitforpid $pid
fi
fi
if [ -f ${PATHBIN}/rc.news.local ]; then
${PATHBIN}/rc.news.local stop
fi
# Delete all of the PID files that we know about to avoid having them
# stick around after a fresh start.
rm -f ${PATHRUN}/cnfsstat.pid $WATCHPID $SERVERPID
rm -f ${PATHRUN}/ovdb_server.pid ${PATHRUN}/ovdb_monitor.pid
exit 0
;;
esac
## Pick ${INND} or ${INNDSTART}
WHAT=${INND}
MAIL="${MAILCMD} -s 'Boot-time Usenet warning on `hostname`' ${NEWSMASTER}"
## RFLAG is set below; set INNFLAGS in inn.conf(5)
RFLAG=""
## Clean shutdown or already running?
if [ -f ${SERVERPID} ] ; then
if kill -0 `cat ${SERVERPID}` 2>/dev/null; then
echo 'INND is running'
exit 0
fi
echo 'INND: PID file exists -- unclean shutdown!'
RFLAG="-r"
fi
if [ ! -f ${PATHDB}/.news.daily ] ; then
case `find ${PATHBIN}/innd -mtime +1 -print 2>/dev/null` in
"")
;;
*)
echo 'No .news.daily file; need to run news.daily?' | eval ${MAIL}
;;
esac
else
case `find ${PATHDB}/.news.daily -mtime +1 -print 2>/dev/null` in
"")
;;
*)
echo 'Old .news.daily file; need to run news.daily?' | eval ${MAIL}
;;
esac
fi
## Active file recovery.
if [ ! -s ${ACTIVE} ] ; then
if [ -s ${NEWACTIVE} ] ; then
mv ${NEWACTIVE} ${ACTIVE}
else
if [ -s ${OLDACTIVE} ] ; then
cp ${OLDACTIVE} ${ACTIVE}
else
echo 'INND: No active file!'
exit 1
fi
fi
RFLAG="-r"
# You might want to rebuild the DBZ database, too:
#cd ${PATHDB} \
# && makehistory -r \
# && mv history.n.dir history.dir \
# && mv history.n.index history.index \
# && mv history.n.hash history.hash
fi
## Overview data was rebuilt, and also active needs to be renumbered
if [ -f ${PATHRUN}/.rebuildoverview ] ; then
echo 'INND: overview was rebuilt, and active needs to be renumbered!'
RFLAG="-r"
fi
## Remove temporary batchfiles and lock files.
( cd ${BATCH} && rm -f bch* )
( cd ${LOCKS} && rm -f LOCK* )
( cd ${TEMPSOCKDIR} && rm -f ${TEMPSOCK} )
rm -f ${NEWSCONTROL} ${NNTPCONNECT} ${SERVERPID} ${PATHRUN}/.rebuildoverview
## Initialize ovdb. Must be done before starting innd.
if [ "$OVMETHOD" = "ovdb" ]; then
echo 'Starting ovdb.'
ovdb_init || {
echo "Can't initialize ovdb (check news.err for OVDB messages)"
exit 1
}
sleep 1
fi
## Start the show.
echo 'Starting innd.'
eval ${WHAT} ${RFLAG} ${INNFLAGS}
# Gee, looks like lisp, doesn't it?
${DOINNWATCH} && {
echo "Scheduled start of ${INNWATCH}."
${INNWATCH} -i 60 > /dev/null &
}
${DOCNFSSTAT} && {
echo "Scheduled start of cnfsstat."
${PATHBIN}/cnfsstat -i 60 -s -l -P > /dev/null &
}
RMFILE=${MOST_LOGS}/expire.rm
for F in ${RMFILE} ${RMFILE}.*; do
if [ -f $F -a -s $F ] ; then
echo "Removing articles from pre-downtime expire run (${F})."
(
echo 'System shut down during expire.' \
'Unlinking articles listed in'
echo ${F}
) | eval ${MAIL}
${PATHBIN}/expirerm ${F}
fi
done &
# Run any additional local startup commands.
if [ -f ${PATHBIN}/rc.news.local ] ; then
${PATHBIN}/rc.news.local start
fi
|