Date: Tue, 20 Apr 2010 09:41:37 +0100 From: Matthew Seaman <m.seaman@infracaninophile.co.uk> To: mcoyles@horbury.wakefield.sch.uk Cc: questions@freebsd.org Subject: Re: Kill via Cron... Message-ID: <4BCD68C1.2010001@infracaninophile.co.uk> In-Reply-To: <002c01cae05e$7eab3ea0$7c01bbe0$@wakefield.sch.uk> References: <002c01cae05e$7eab3ea0$7c01bbe0$@wakefield.sch.uk>
next in thread | previous in thread | raw e-mail | index | archive | help
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 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: > > kill -9 `ps ax | grep backup | grep -v grep | awk '{print $1}'` && kill -9 > `ps ax | grep dump | grep -v grep | awk '{print $1}'` > > > Error: > > usage: kill [-s signal_name] pid ... > kill -l [exit_status] > kill -signal_name pid ... > kill -signal_number pid ... > > 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' Cheers, Matthew - -- Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard Flat 3 PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate Kent, CT11 9PW -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.14 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkvNaMAACgkQ8Mjk52CukIzY7ACfaRdjM5GhHDwger7dZyZ0089F asoAn01GiwM4Fxqnf2cfzqhgWxbQmw50 =HqkV -----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4BCD68C1.2010001>