From owner-freebsd-questions Fri Dec 10 0:38: 0 1999 Delivered-To: freebsd-questions@freebsd.org Received: from axl.noc.iafrica.com (axl.noc.iafrica.com [196.31.1.175]) by hub.freebsd.org (Postfix) with ESMTP id E22741519F for ; Fri, 10 Dec 1999 00:37:51 -0800 (PST) (envelope-from sheldonh@axl.noc.iafrica.com) Received: from sheldonh (helo=axl.noc.iafrica.com) by axl.noc.iafrica.com with local-esmtp (Exim 3.11 #1) id 11wLYc-0002D8-00; Fri, 10 Dec 1999 10:37:42 +0200 From: Sheldon Hearn To: "james orme" Cc: freebsd-questions@FreeBSD.ORG Subject: Re: Script Help In-reply-to: Your message of "Thu, 09 Dec 1999 17:29:14 PST." <19991210012914.86779.qmail@hotmail.com> Date: Fri, 10 Dec 1999 10:37:42 +0200 Message-ID: <8501.944815062@axl.noc.iafrica.com> Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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