-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetworking.sh
More file actions
executable file
·51 lines (43 loc) · 930 Bytes
/
getworking.sh
File metadata and controls
executable file
·51 lines (43 loc) · 930 Bytes
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/sh
set -eu
LOGDIR="out/" ;
usage () { # {{{
cat <<-USAGE
usage: $0 -i NODELIST -l SLICE [-t TIMEOUT]
this will print hosts in NODELIST that we can SSH into and run 'hostname' on.
SLICE should be a planetlab slice name, e.g., upmc_ts. TIMEOUT defaults to 5
seconds.
USAGE
exit 1
} # }}}
slice=invalid
nodelist=invalid
timeout=5
while getopts "i:l:t:h" OPTNAME ; do # {{{
case $OPTNAME in
i)
nodelist=$OPTARG
;;
l)
slice=$OPTARG
;;
t)
timeout=$OPTARG
;;
h|*)
usage
;;
esac
done
shift $(expr $OPTIND - 1)
OPTIND=1 # }}}
test $slice != invalid || usage
test $nodelist != invalid || usage
if [ ! -f $nodelist ] ; then echo "nodelist not found." ; exit 1 ; fi
vxargs -pry -t $timeout -a $nodelist -o $LOGDIR/getworking ssh $slice@{} hostname > /dev/null
cd $LOGDIR/getworking
for file in $(ls *.out) ; do
name=$(cat $file)
if [ "$name" = "${file%.out}" ] ; then echo ${file%.out} ; fi
done
cd - > /dev/null