#!/bin/sh

# Check to see if the innfeed funnel process ($FEED) is running.
# If not, start it. Assumes a "feedfunnel" script exists, and is used
# to start innfeed.

# John Milburn 97.5.17
# -jem@xpat.com

#### =()<. @<_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
    if ( (ps ax >/dev/null 2>&1) ) then
	PSCMD="ps ax"
    else
	PSCMD="ps -ef"
    fi
fi


FEED="funnel"

echo "checking for ${FEED}"
PROC=`$PSCMD|${EGREP} innfeed|${EGREP} -v grep|${EGREP} ${FEED}|${AWK} '{print $2}'`
if [ "X${PROC}" = X ]; then
	rm -f ${BATCH}/*.lock
	rm -f ${LOCKS}/innfeed-${FEED}.pid
	${NEWSBIN}/feedfunnel
	${MAILCMD} -s "innfeed feed ${FEED} restarted" ${NEWSMASTER} </dev/null
fi
exit 0
