Created
May 12, 2014 16:49
-
-
Save icaoberg/0cd48f9483b5644f7974 to your computer and use it in GitHub Desktop.
[PBS] List nodes by queue name #cluster
This file contains 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 | |
#TODO make it faster | |
if [ $# -eq 0 ] | |
then | |
for NODE in `pbsnodes | grep -R "compute" | cut -d"=" -f1 | grep -R "compute"` | |
do | |
QUEUE=`pbsnodes $NODE | grep "properties" | cut -d"=" -f2` | |
echo $NODE $QUEUE | |
done | |
elif [ $# -eq 1 ] | |
then | |
QUERY_QUEUE_NAME=`echo $1 | tr -d ' '` | |
for NODE in `pbsnodes | grep -R "compute" | cut -d"=" -f1 | grep -R "compute"` | |
do | |
QUEUE=`pbsnodes $NODE | grep "properties" | cut -d"=" -f2 | tr -d ' '` | |
if [ "$QUEUE" == "$QUERY_QUEUE_NAME" ] | |
then | |
echo $NODE | |
fi | |
done | |
else | |
echo "Usage" | |
echo "list_nodes_by_queue.sh" | |
echo "list_nodes_by_queue.sh <queue_name>" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment