Skip to content

Instantly share code, notes, and snippets.

@noisychannel
Created April 23, 2015 22:01
Show Gist options
  • Save noisychannel/de2883a5d9cfca021de9 to your computer and use it in GitHub Desktop.
Save noisychannel/de2883a5d9cfca021de9 to your computer and use it in GitHub Desktop.
Monitor qsub jobs
#!/bin/bash
username="gkumar"
while true
do
clear
printf '%99s\n' | tr ' ' -
echo "My Jobs"
printf '%99s\n' | tr ' ' -
printf "Number of jobs currently running : `qstat | grep $username | awk '{if (\$5 == \"r\") {print \$_;}}' | wc -l` \n\n"
printf "Jobs running:\n"
printf "`qstat | grep $username | awk '{if (\$5 == \"r\") {print \$_;}}' | awk '{print $1, $3}' | sort | uniq -c `"
printf "\n\n"
printf "Machines on which jobs are running: \n"
printf "`qstat | grep $username | awk '{if (\$5 == \"r\") {print \$_;}}' | awk '{print $8}' | sort | uniq -c`"
printf "\n"
printf '%99s\n' | tr ' ' -
printf "Queue Information \n"
printf '%99s\n' | tr ' ' -
printf "Current Users :\n`q.who`"
printf "\n\n"
printf '%99s\n' | tr ' ' -
printf "Log information \n"
printf '%99s\n' | tr ' ' -
i=1
for var in "$@"
do
printf "Log $i :\n"
printf "`tail $var`"
printf "\n\n"
done
sleep 5
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment