This commit is contained in:
Aryan Singh committed 2026-09-12 19:22:35 -05:00
1 parent ca1073beda
commit 249f0b844b
5 files changed
+58 -1

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
#!/usr/bin/env bash
CMD='cd fa26_cs425_.group-mp_.team-01/MP1 && nohup python3 server.py </dev/null >/dev/null 2>&1 &'
if [[ "$#" -eq 0 ]]; then
echo "Need at least one server number as an argument."
exit 1
fi
if [[ "$1" == "all" ]]; then
TARGETS="1 2 3 4 5 6 7 8 9 10"
else
TARGETS="$@"
fi
echo "Starting servers"
for i in $TARGETS; do
vpn ssh -n -f -o BatchMode=yes "server$i" "$CMD"
done
sleep 2
for i in $TARGETS; do
pid=$(vpn ssh -n -o BatchMode=yes "server$i" "pgrep -o -u \$USER -f '[p]ython3 server.py'")
if [[ -n "$pid" ]]; then
pid_clean=$(echo "$pid" | tr '\n' ' ')
echo "Server$i is running with PID(s): $pid_clean"
else
echo "Server$i is not running."
fi
done