forked from vigneshkmr84/Distributed-Minimum-Spanning-Tree
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcleanup-mac.sh
More file actions
executable file
·38 lines (26 loc) · 737 Bytes
/
cleanup-mac.sh
File metadata and controls
executable file
·38 lines (26 loc) · 737 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
#!/usr/bin/env bash
# Change this to your netid
netid=kxp210004
# Root directory of your project
PROJECT_DIR=$HOME/Desktop/DC-Minimum-Spanning-Tree
# Directory where the config file is located on your local system
CONFIG_LOCAL=$PROJECT_DIR/config.txt
n=0
cat $CONFIG_LOCAL | sed -e "s/#.*//" | sed -e "/^\s*$/d" |
(
read i
echo $i
while [[ $n -lt $i ]]
do
read line
host=$( echo $line | awk '{ print $2 }' )
echo $host
osascript -e '
tell app "Terminal"
do script "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no '$netid@$host' killall -u '$netid'"
end tell'
sleep 1
n=$(( n + 1 ))
done
)
echo "Cleanup complete"