Last active
July 30, 2024 00:56
-
-
Save ImBIOS/178afb5b6e6c164677e498aff3f1d756 to your computer and use it in GitHub Desktop.
This bash script retrieves and displays the properties of all free nodes in a PBS (Portable Batch System) 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
for node in $(pbsnodes -l free | awk '{print $1}'); do | |
echo "$node" | |
pbsnodes "$node" | awk '/state = free/ {state=$0} /properties =/ {prop=$0} END {print " " state; print " " prop}' | |
echo "" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Get Properties of Free Nodes in PBS
This bash script retrieves and displays the properties of all free nodes in a PBS (Portable Batch System) cluster.
Usage:
Save the script to a file (e.g.,
free_node_properties.sh
) and make it executable (chmod +x free_node_properties.sh
). Then, run the script:Output:
The script will print the name of each free node followed by its "state = free" line and its "properties = ..." line, indented for readability. For example:
How it Works:
pbsnodes -l free
to get a list of free nodes.pbsnodes <node_name>
to get the node's detailed information.awk
to extract and print the "state = free" and "properties = ..." lines.Note:
This script assumes that the
pbsnodes
command is available in your environment.