collect_cpu_time.sh 633 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#!/usr/bin/env bash

# Labs are directly under the root account
# There is a documented bug in sacct that will print all accounts whatever the filter
# That is, Parent=root only main concequence is that the parent name will only be printed
# if it's root and left banck otherwise.

labs=$(sacctmgr show account WithAssoc format=Account,ParentName Parent=root -P -n | egrep -v "\|$" | sed -e 's/|root//')

for lab in $labs
do
    echo Lab: $lab
    teams=$(sacctmgr show account WithAssoc format=Account,ParentName Parent=$lab -P -n | egrep -v "\|$" | sed -e "s/|$lab//")
    for team in $teams
    do
	echo Team: $team
    done
done