#!/bin/bash # # This script is provided without charge by Lisa M. Perez at the Laboratory for Molecular Simulation (LMS) # at Texas A&M University and is provided on an "as is" basis and has not been fully tested. # # Please e-mail Lisa M. Perez at mouse@mail.chem.tamu.edu with problems. # # qstat_fs.bash will take the results from a qstat command on cosmos and print it back out # with an additional column listing the users fair share value. The higher your fair share value, # the lower the priority you have in the queue. This script will only work with the following qstat # flags: -u username, -r, -G, -a, -s, and -M. For information on these flags and others available for # the qstat command type man qstat or info qstat at the prompt on cosmos. # # To use this script, you will want to add the following to your .bashrc file (These are just suggestions # and may be modified to fit your needs): # # function q() { $HOME/qstat_fs.bash "qstat -G -u $LOGNAME" "$@" ; } # function qa() { $HOME/qstat_fs.bash "qstat -G -a" "$@" ; } # function qr() { $HOME/qstat_fs.bash "qstat -G -r" "$@" ; } # # At the prompt type: # q to see your jobs # qa to see everyones jobs # qr to see everyones running jobs # q -r to see your running jobs # # You may also list results for a specific queue by adding the queue name at the end of the command: # q p8 to see your jobs in the queue p8 # qr normal to see all running jobs in the normal queue # qa xlong to see all jobs in the xlong queue # qa long xlong to see all running jobs in long and xlong # etc # last modified 12/01/05 command="$@" $command > .qstat_temp i=6 jobs=`awk '{a=NR};END {if (a=="") {print "0"} else {print a}}' .qstat_temp` if [ "$jobs" -eq "0" ] then echo 'There are no jobs to list' rm .qstat_temp exit fi head -n 2 .qstat_temp awk '{if (NR==3) {printf "%-80.80s Fair\n",$0}}' .qstat_temp awk '{if (NR==4) {printf "%-80.80s Share\n",$0}}' .qstat_temp awk '{if (NR==5) {printf "%-80.80s -----\n",$0}}' .qstat_temp while [ $i -le $jobs ] do user=`awk '{if (NR=='$i') {print $2}}' .qstat_temp` user_fs=`/usr/local/bin/pbs_fs.pl|grep $user" "|awk '{print $10}'` awk '{if (NR=='$i') {printf "%-80.80s ",$0}}' .qstat_temp echo $user_fs i=$[++i] done rm .qstat_temp exit