#!/bin/sh
#
# PTlink Open Proxy Monitor Crontab 
#

#change this to your data directory
ddir="/etc/ircopm"

# I wouldn't touch this if I were you.
opmname="/var/run/ircopm-ptlink/ircopm.pid"

########## you probably don't need to change anything below here ##########

if test -r $opmname; then
  # there is a pid file -- is it current?
  opmpid=`cat $opmname`
  if `kill -CHLD $opmpid >/dev/null 2>&1`; then
    # it's still going
    # back out quietly
    exit 0
  fi
  echo ""
  echo "Stale $opmname file (erasing it)"
  rm -f $opmname
fi
echo ""
echo "Couldn't find the open proxy monitor running.  Reloading it..."
echo ""
/etc/init.d/ircopm-ptlink start

