File:  [ELWIX - Embedded LightWeight unIX -] / elwix / config / etc / default / rc.watchdog
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Jul 5 23:43:00 2011 UTC (13 years, 3 months ago) by misho
Branches: misho, MAIN
CVS tags: start, elwix2_8, elwix2_7, elwix2_6, elwix2_3, elwix2_2, elwix2_1, elwix2_0, elwix1_9_mips, elwix1_9, elwix1_8, elwix1_7, elwix1_6, elwix1_5, elwix1_4, Patch1, HEAD, ELWIX2_7, ELWIX2_6, ELWIX2_5, ELWIX2_2p0, ELWIX2_1, ELWIX2_0, ELWIX1_9, ELWIX1_8, ELWIX1_7, ELWIX1_6, ELWIX1_5
ELWIX project

    1: #!/bin/sh
    2: #
    3: # (C)`10 AITNET ltd - Sofia/Bulgaria - office@aitbg.com
    4: #   by Michael Pounov <misho@aitbg.com>
    5: #
    6: # rc.watchdog <program_name_for_watch>
    7: #
    8: # $Id: rc.watchdog,v 1.1.1.1 2011/07/05 23:43:00 misho Exp $
    9: #
   10: 
   11: TIMEOUT=60
   12: LOG="/var/log/watchdog.log"
   13: 
   14: if [ -z $1 ]; then
   15: 	echo "Not specified program name for watch ..."
   16: 	exit
   17: else
   18: 	PROG=$1
   19: 	shift
   20: fi
   21: 
   22: while : ; do
   23: 	pgrep -q `basename $PROG`
   24: 	if [ $? -ne 0 ]; then
   25: 		$PROG $* >/dev/null 2>&1
   26: 		echo "Watchdog restart $PROG [$*] ... $?" >>$LOG
   27: 	else
   28: 		sleep $TIMEOUT
   29: 	fi
   30: done

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>