Date: Fri, 10 Dec 1999 10:37:42 +0200 From: Sheldon Hearn <sheldonh@uunet.co.za> To: "james orme" <jaorme@hotmail.com> Cc: freebsd-questions@FreeBSD.ORG Subject: Re: Script Help Message-ID: <8501.944815062@axl.noc.iafrica.com> In-Reply-To: Your message of "Thu, 09 Dec 1999 17:29:14 PST." <19991210012914.86779.qmail@hotmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 09 Dec 1999 17:29:14 PST, "james orme" wrote: > Hi I need to write a script that executes the kill command from least severe > to most severe on a selected file. There are two points of confusion here. The first is the issue of severity, which depends very much on how the recpient of any given signal chooses to deal with it (SIGKILL being the only real exception). The second is what you mean by "executing the kill command ... on a selected file". I'll interpret that as "send a signal to any process with the specified name, using the kill command". So choose your order of severity and do something like this: #!/bin/sh progname="myprog" siglist="1 15 2 6 9" for i in ${siglist}; do if killall -$i ${progname}; then echo signal $i delivered to ${progname} else exit 1 fi sleep 1 done This is very silly stuff, though. There are all sorts of problems involved here. It'd be much better if you explained what the problem was so that we could offer you a specific solution. :-) Ciao, Sheldon. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8501.944815062>