#!/bin/sh 

# quick script to stop and start swatch jobs

# starts the tail -f on sybase errorlog and backup server errorlog
startem ()
{
   swatch -c swatchrc -t peter_errorlog  &
   swatch -c swatchrc -t peter_bkup_errorlog &
   swatch -c swatchrc -t peter_datatools_log &
   #swatch -c swatchrc -t peter_open_svr_log &
}

# and this kills 'em
killem ()
{
   ps -fe|grep sybase|egrep "perl|tail|swatch"|grep -v restart|while read line
   do
      pid=`echo $line | awk '{print $2}'`
      kill -9 $pid
   done
}

cd /export/syb_ops/swatch
killem
sleep 10
startem