RE: Kill via Cron...

2010-04-21 Thread mcoyles
kill -9 `ps ax | grep backup | grep -v grep | awk '{print $1}'` And you don't have to remember grep -v grep if you remember to use ps axc (note the c), since arguments won't show up so the arguments to grep won't generate a false positive. I'm actually trying to kill the following in one

Re: Kill via Cron...

2010-04-21 Thread Matthew Seaman
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 21/04/2010 09:36:24, mcoyles wrote: I'm actually trying to kill the following in one swep if they've taken more than 8 hours to complete... : 39028 ?? Is 0:00.01 /bin/sh -c sh /root/tools/backup/fullbackup.sh 39070 ?? I 0:00.04

Re: Kill via Cron...

2010-04-21 Thread Karl Vogel
On 21/04/2010 09:36:24, mcoyles wrote: M I'm actually trying to kill the following in one swep if they've taken M more than 8 hours to complete... : M 62221 ?? S 0:27.11 gzip -q M 62223 ?? DL 0:01.80 /sbin/dump -0 -auf - /usr (dump) M 62224 ?? DL 0:01.79 /sbin/dump -0 -auf -

Re: Kill via Cron...

2010-04-20 Thread Matthew Seaman
-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

RE: Kill via Cron...

2010-04-20 Thread mcoyles
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

Re: Kill via Cron...

2010-04-20 Thread Matthew Seaman
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 20/04/2010 11:24:44, mcoyles wrote: 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 |

Re: Kill via Cron...

2010-04-20 Thread Randal L. Schwartz
mcoyles == mcoyles mcoy...@horbury.wakefield.sch.uk writes: mcoyles kill -9 [from a post I made frequently in comp.unix.questions...] No no no. Don't use kill -9. It doesn't give the process a chance to cleanly: 1) release IPC resources (shared memory, semaphores, message queues) 2)

Re: Kill via Cron...

2010-04-20 Thread Karl Vogel
On Tue, 20 Apr 2010 08:52:58 +0100, mcoyles mcoy...@horbury.wakefield.sch.uk said: M kill -9 `ps ax | grep backup | grep -v grep | awk '{print $1}'` I've typed ps ax | grep something | grep -v grep often enough to automate it. The psax script below accepts an optional egrep-style

Re: Kill via Cron...

2010-04-20 Thread Randal L. Schwartz
Karl == Karl Vogel voge...@hcst.com writes: On Tue, 20 Apr 2010 08:52:58 +0100, mcoyles mcoy...@horbury.wakefield.sch.uk said: M kill -9 `ps ax | grep backup | grep -v grep | awk '{print $1}'` And you don't have to remember grep -v grep if you remember to use ps axc (note the c), since

Re: Kill via Cron...

2010-04-20 Thread George Davidovich
On Tue, Apr 20, 2010 at 12:57:25PM -0700, Randal L. Schwartz wrote: Karl == Karl Vogel voge...@hcst.com writes: On Tue, 20 Apr 2010 08:52:58 +0100, mcoyles mcoy...@horbury.wakefield.sch.uk said: M kill -9 `ps ax | grep backup | grep -v grep | awk '{print $1}'` And you don't