Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 May 1997 20:37:45 +0200
From:      j@uriah.heep.sax.de (J Wunsch)
To:        hackers@FreeBSD.ORG
Subject:   Re: process monitoring tool (like SysV init)?
Message-ID:  <19970521203745.EU46231@uriah.heep.sax.de>
In-Reply-To: <9705210854.AA02911@poveri.tekla.fi>; from Sakari Jalovaara on May 21, 1997 11:54:40 %2B0300
References:  <9705210854.AA02911@poveri.tekla.fi>

next in thread | previous in thread | raw e-mail | index | archive | help
As Sakari Jalovaara wrote:

> It struck me as a rather nice idea.  No more "ps | grep sendmail ...
> kill ... sendmail -bd -q1h" - just do "nanny restart sendmail".

All `conforming' daemons leave their PID in /var/run/<name>.pid.

Thus, restart.sh:

#!/bin/sh

if [ $# -ne 1 ] ; then
	echo "usage: $0 <daemonname>" >&2
	exit 64
fi

if [ -f /var/run/$1.pid ] ; then
	# the head -1 is only needed for sendmail, but doesn't hurt
	pid=$(head -1 /var/run/$1.pid)
	if [ "X$pid" != X ] ; then
		echo "Sending SIGHUP to PID $pid..."
		kill -HUP $pid
		exit $?
	fi
fi

echo "/var/run/$1.pid doesn't exist or is empty" >&1
exit 72

-- 
cheers, J"org

joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)



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