Date: Thu, 22 May 1997 08:39:56 +0100 From: Brian Somers <brian@awfulhak.org> To: joerg_wunsch@uriah.heep.sax.de (Joerg Wunsch) Cc: hackers@FreeBSD.ORG Subject: Re: process monitoring tool (like SysV init)? Message-ID: <199705220739.IAA07095@awfulhak.demon.co.uk> In-Reply-To: Your message of "Wed, 21 May 1997 20:37:45 %2B0200." <19970521203745.EU46231@uriah.heep.sax.de>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --] > 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. [.....] > -- > 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. ;-) That reminds me. Is anyone interested in a "pkill" command ? It's a shell script (attached 'cos it's not too big) that kills processes by name - so you can say "pkill -HUP named" for example. It would be nice to commit this. -- Brian <brian@awfulhak.org>, <brian@freebsd.org> <http://www.awfulhak.org> Don't _EVER_ lose your sense of humour.... [-- Attachment #2 --] #! /bin/sh # kill the named process(es) case $1 in -*) flag=$1; shift;; esac [ $# -eq 0 ] && { echo Usage: pkill procname...; exit 1; } running=`ps axopid,command | sed -e 's/^ *//' \ -e 's,^\([0-9]*\) .*(\([^)]*\))$,\1 \2,' \ -e 's,^\([0-9]*\) [^ ]*/,\1 ,' \ -e 's,^\([0-9]*\) \([^ ]*\) .*,\1 \2,'` ifs="$IFS" IFS= for f do pid=`echo $running | sed -n "/ $f$/ s/ .*//p"` [ -z "$pid" ] && echo "$f: No such process." >&2 || pids="$pids $pid" done [ -n "$pids" ] && { IFS="$ifs" pids="`echo $pids`" echo kill $flag $pids kill $flag $pids }help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199705220739.IAA07095>
