#!/bin/sh

#
# $Header: /var/news/local/bin/RCS/checkinnd,v 1.5 1997/04/07 03:53:59 news Exp news $

# This script check to see if the innd process is running.  If not, then
# rc.news is run.  This should help to clean up any random innd crashes.
# I run this program once every 20 minutes from cron.

# -jem
# John Milburn

# Get the INN path definitions
#### =()<. @<_PATH_SHELLVARS>@>()=
. /var/news/etc/innshellvars

## Uncomment one of following
#PSCMD="ps ax"		# Linux and BSD
#PSCMD="ps -ef"		# Solaris-2.x and SYSV

if [ "X$PSCMD" = "X" ] ;then
  exit 0
fi

# Check ps for a running innd process
INNDPS=X`$PSCMD | ${EGREP} ${INND} | ${EGREP} -v grep |${AWK} '{print $1}'`

# If the tmpfile is zero size
if [ $INNDPS = "X" ] ;  then
# Start news
#### =()<	@<_PATH_NEWSBOOT>@>()=
	/usr/news/bin/rc.news
# And send mail to the admin
	$MAILCMD -s "INND restarted by checkinnd" $NEWSMASTER
fi

exit 0
