Skip to content

Instantly share code, notes, and snippets.

@usuyama
Created June 2, 2012 03:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save usuyama/2856411 to your computer and use it in GitHub Desktop.
Save usuyama/2856411 to your computer and use it in GitHub Desktop.
qsub and check qstat
#!/bin/bash
#$ -S /bin/bash
#$ -cwd
job_id=$(qsub $@ | ruby -ane 'print $F[2]')
while true
do
is_exist=$(qstat | ruby -ane "print 1 if \$F.first == '$job_id'")
if [ -z "$is_exist" ];then
break
fi
sleep 60
done
@usuyama
Copy link
Author

usuyama commented Jun 2, 2012

8行目のエスケープが難しくて、ほんとは
if [ -z qstat | ruby -ane "if \$F.first == '$job_id';print 1;end" ];then
みたいにしたいんだけど、うまくいかない

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment