Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Apr 1997 22:07:36 -0400
From:      Deion Christopher Smith <dsmith@zyga.com>
To:        Dan Wolfe <DWolfe@zyga.com>, "'leec@adonai.net'" <leec@adonai.net>
Cc:        "'questions@freebsd.org'" <questions@freebsd.org>, "'dsmith@zyga.com'" <dsmith@zyga.com>
Subject:   RE: Cron jobs
Message-ID:  <01BC50FB.EB7A3780@gold.zyga.com>

next in thread | raw e-mail | index | archive | help
Thanks!

Dan, I told you it was a 10 liner, I just want to look up old refs. on fine tuning a kron.

Deion

----------
From: 	Lee Crites[SMTP:leec@adonai.net]
Sent: 	Wednesday, April 23, 1997 6:50 PM
To: 	Dan Wolfe
Cc: 	'questions@freebsd.org'; 'dsmith@zyga.com'
Subject: 	Re: Cron jobs

Dan Wolfe wrote:
> 
> FreeBSD Users:
> 
> Has anyone written a script to periodically check if a particular process is running, and if not, restart it?
> 
> -Dan Wolfe
> ZYGA Corporation

Try this script on for size, it's working for me, anyway...

#!/bin/csh -f
#
# check for program and start it if it is not found
#
  echo "Check/starting process"

#
# program name should be $1
#
  if ($1 == "") then
    echo "usage: $0 program-to-check"
    exit
    endif

  set STR = $1
  echo " -- starting "$STR

#
# see if it is running and start it if needed
#
  if (`ps -aux|grep -v grep|grep -c $STR` == 0) then

    echo " -- starting process"
    $STR >>& /dev/null &

  else

    echo " -- process already running"

  endif

#
# done
#






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?01BC50FB.EB7A3780>