Wednesday, March 9, 2011

Removing "at" jobs in bash.

Here's a basic bash command to remove a job named 'poweroff''  this can remove other at jobs just by changing what you are greping for.  This is handy as I can use this in a script or send it out remotely to multiple systems and it doesn't require any interaction.

for job in `at -l | cut -f 1`; do at -c $job | grep -e 'poweroff' >/dev/null && atrm $job; done



Have fun with it.

No comments:

Post a Comment