-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcheck_ood_usage.sh
38 lines (29 loc) · 1.04 KB
/
check_ood_usage.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
# Script written by Ghanghoon "Will" Paik (gip5038@psu.edu)
# Date: 11/19/2019
# Last modified: 11/19/2019
# Check for inputs
if [[ $# -gt 1 ]]; then
echo -e "Error: \tTo many inputs"
echo -e "Usage: \t$(basename $0) <app> or <desktop>\n\tOr, $(basename $0) for desktop"
echo " "
exit 1
fi
input=${1}
echo " "
if [[ -z $input ]]; then
input=desktop
echo "Checking for OoD Interactive Desktop sessions"
else
echo "Checking OoD $input sessions"
fi
echo " "
if [[ ! -z $input ]]; then
qstat -n1t | grep open | grep comp-ic* >> tmp_ood_sessions
less tmp_ood_sessions | grep R | grep g$input | wc -l | awk '{print "----->\tCurrently running OoD '$input' sessions: "$1}'
less tmp_ood_sessions | grep Q | grep g$input | wc -l | awk '{print "----->\tCurrently queued OoD '$input' sessions: "$1}'
echo " "
less tmp_ood_sessions | grep R | wc -l | awk '{print "----->\t" $1 " out of 120 OoD sessions are in use now"}'
rm tmp_ood_sessions
fi
echo " "