-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstop.sh
More file actions
executable file
·27 lines (22 loc) · 801 Bytes
/
stop.sh
File metadata and controls
executable file
·27 lines (22 loc) · 801 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
#!/bin/bash
SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
VARIABLES="${SOURCE_DIR}/.env"
# Load REMOTE_USER
if [[ -f "$VARIABLES" ]]; then
source "$VARIABLES"
fi
if [[ -z "$REMOTE_USER" ]]; then
echo "REMOTE_USER variable not set"
fi
PROXY="melkki.cs.helsinki.fi"
DESTINATIONS=("svm-11.cs.helsinki.fi" "svm-11-2.cs.helsinki.fi" "svm-11-3.cs.helsinki.fi")
# Look for the pid in each destination.txt and kill the process
# on the server. Delete the pid destination.txt file after killing the process
for DEST in "${DESTINATIONS[@]}"; do
if [[ -f "pid_${DEST}.txt" ]]; then
PID=$(cat "pid_${DEST}.txt")
echo "Stopping $DEST (PID $PID)..."
ssh -J "${REMOTE_USER}@${PROXY}" "${REMOTE_USER}@${DEST}" "kill $PID"
rm "pid_${DEST}.txt"
fi
done