Created
March 21, 2015 16:41
-
-
Save MikeDacre/e85b0ccd85807a352120 to your computer and use it in GitHub Desktop.
Watch a submitted qsub job and email the results of qstat -f when complete
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 | |
| if [ $# != 2 ]; then | |
| echo "USAGE: watch_job <submit_script> <email_address>" | |
| exit 1 | |
| fi | |
| job=$1 | |
| email=$2 | |
| while true; do | |
| sleep 1 | |
| i=$(qstat -u $USER | grep $job | grep " C ") | |
| if [ $i ]; then | |
| sleep 5 | |
| output=$(qstat -u $USER -f) | |
| echo $output | sendmail -s "Job Complete" [email protected] | |
| exit | |
| fi | |
| done |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Run in background:
nohup watch_job <job_no> <your_email> &