Date: Tue, 20 Apr 2010 11:24:44 +0100 From: "mcoyles" <mcoyles@horbury.wakefield.sch.uk> To: "'Matthew Seaman'" <m.seaman@infracaninophile.co.uk> Cc: questions@freebsd.org Subject: RE: Kill via Cron... Message-ID: <006d01cae073$b1ff2630$15fd7290$@wakefield.sch.uk> In-Reply-To: <4BCD68C1.2010001@infracaninophile.co.uk> References: <002c01cae05e$7eab3ea0$7c01bbe0$@wakefield.sch.uk> <4BCD68C1.2010001@infracaninophile.co.uk>
next in thread | previous in thread | raw e-mail | index | archive | help
>>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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?006d01cae073$b1ff2630$15fd7290$>