Created
April 18, 2014 08:57
-
-
Save ctrlcctrlv/11032666 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Save $1 because `set` will overwrite it | |
| QUEUE_TO_DELETE=$1; | |
| # $1 is our job ID, $7 is our queue name | |
| ATQ=`atq|awk '{print $1, $7}'`; | |
| while read line | |
| do | |
| set $line; | |
| # $1 is still our job ID, $2 is now our queue name | |
| if [ "$2" == "$QUEUE_TO_DELETE" ] || [ "$QUEUE_TO_DELETE" == '--all' ] | |
| then | |
| atrm $1; | |
| if [ $? -ne 0 ] | |
| then | |
| echo "Failed to delete job $1" 1>&2; | |
| fi | |
| echo "Deleted job $1" 1>&2; | |
| fi | |
| done <<< "$ATQ" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment