Kill via Cron...

mcoyles mcoyles at horbury.wakefield.sch.uk
Wed Apr 21 08:36:37 UTC 2010


>>> 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 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 /usr/bin/perl /root/tools/backup/backuptodisk.pl
(perl5.8.9)
62219  ??  I      0:00.00 sh -c /sbin/dump -0 -auf - /usr | gzip -q >
/backup/wednesday/usr.dump.gz
62220  ??  I      0:00.33 /sbin/dump -0 -auf - /usr (dump)
62221  ??  S      0:27.11 gzip -q
62222  ??  S      0:03.07 dump: /dev/da0s1e: pass 4: 3.82% done, finished in
1:09 at Wed Apr 21 09:48:59 2010 (dump)
62223  ??  DL     0:01.80 /sbin/dump -0 -auf - /usr (dump)
62224  ??  DL     0:01.79 /sbin/dump -0 -auf - /usr (dump)
62225  ??  DL     0:01.81 /sbin/dump -0 -auf - /usr (dump)

Have tried everything suggested thus far but nothing's done it as
effectively as the original command run at commandline... just trying to
automate the process by having cron kill at 8am.

Cheers!
Marci



More information about the freebsd-questions mailing list