From owner-freebsd-questions@FreeBSD.ORG Tue Apr 20 10:24:58 2010 Return-Path: Delivered-To: questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 737E2106564A for ; Tue, 20 Apr 2010 10:24:58 +0000 (UTC) (envelope-from mcoyles@horbury.wakefield.sch.uk) Received: from smtp2.yhgfl.net (smtp2.yhgfl.net [89.207.208.210]) by mx1.freebsd.org (Postfix) with ESMTP id 2DF7B8FC14 for ; Tue, 20 Apr 2010 10:24:57 +0000 (UTC) Received: from smtp2.yhgfl.net (localhost.localdomain [127.0.0.1]) by localhost (Email Security Appliance) with SMTP id 700E21BC08C9_BCD800FB; Tue, 20 Apr 2010 10:21:03 +0000 (GMT) Received: from smtp3-wak.yhgfl.net (eca.yhgfl.net [89.207.208.91]) by smtp2.yhgfl.net (Sophos Email Appliance) with ESMTP id 20BEE1BC08C4_BCD800DF; Tue, 20 Apr 2010 10:21:01 +0000 (GMT) Received: from horbury.wakefield.sch.uk ([10.126.96.3]) by smtp3-wak.yhgfl.net (8.13.8/8.13.8/Debian-3) with ESMTP id o3KAOlFM032283; Tue, 20 Apr 2010 11:24:48 +0100 Received: from ITTEAM02 [172.16.96.253] by horbury.wakefield.sch.uk with ESMTP (SMTPD32-7.07) id A0EA2D4C00FA; Tue, 20 Apr 2010 11:24:42 +0100 From: "mcoyles" To: "'Matthew Seaman'" References: <002c01cae05e$7eab3ea0$7c01bbe0$@wakefield.sch.uk> <4BCD68C1.2010001@infracaninophile.co.uk> In-Reply-To: <4BCD68C1.2010001@infracaninophile.co.uk> Date: Tue, 20 Apr 2010 11:24:44 +0100 Message-ID: <006d01cae073$b1ff2630$15fd7290$@wakefield.sch.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook 12.0 thread-index: AcrgZW5HsAY9NxyLSW6t8Cgllzz+QQADYsJg Content-Language: en-gb X-YHGfL-MailScanner-Information: Please contact the YHGfL Foundation for more information X-YHGfL-MailScanner: Found to be clean X-YHGfL-MailScanner-MCPCheck: MCP-Clean, MCP-Checker (score=0, required 0.5) X-YHGfL-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-4.399, required 5, autolearn=not spam, ALL_TRUSTED -1.80, BAYES_00 -2.60) X-MailScanner-From: mcoyles@horbury.wakefield.sch.uk Cc: questions@freebsd.org Subject: RE: Kill via Cron... X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: mcoyles@horbury.wakefield.sch.uk List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2010 10:24:58 -0000 >>On 20/04/2010 08:52:58, mcoyles wrote: >> Morning all - on FreeBSD 7.1 (for various reasons - don't ask) >> Am attempting to run the following via cron but it keeps erroring = out: >>=20 >> kill -9 `ps ax | grep backup | grep -v grep | awk '{print $1}'` && = kill -9 >> `ps ax | grep dump | grep -v grep | awk '{print $1}'` >>=20 >> *snip*=20 >>=20 >> Works OK from commandline - what do I need to change to make this = cronable?? > The usual problem is that the environment under cron is not set up > anything like the way it is for an interactive session. Particularly > the PATH. Either write you command as a small shell script and setup > PATH within it, or use fully qualified names for all commands. > > Your command is probably better expressed as: > > /bin/pkill -9 'backup|dump' Hi Matthew - cheers for that, I always forget the lack of common path in = cron *sigh* Anyhoo, there are multiple instances of backup and dump coming back in = ps -ax... your suggested command appears to only kill off the first instance? Have used = my commands=20 above in cron now using full path reference as per your advice - just = waiting for the clock to click round to 11.30 here for them to run... Cheers... Marci