Skip to content

Commit dde5271

Browse files
committed
Fixed cleanup
1 parent 395a74d commit dde5271

File tree

2 files changed

+25
-29
lines changed

2 files changed

+25
-29
lines changed

evergreen/cleanup-test-resources.sh

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,29 @@ else
1313
ps -ax | grep mongocryptd
1414
pkill -f 'mongocryptd' || echo 'mongocryptd was already killed or not launched'
1515
# check that it's actually killed
16-
ps -ax | grep mongocryptd
16+
ps -ax | grep mongocryptd
1717
fi
18+
19+
# The proxy server processes have almost certainly already been killed by the evergreen process cleaning though.
20+
# This is just to be sure it already happened and delete the file containing the saved PIDs.
21+
22+
echo "Attempting to kill proxy servers if present and deleting PID file."
23+
PID_FILE="socks5_pids.txt"
24+
25+
if [[ ! -f "$PID_FILE" ]]; then
26+
echo "No PID file found ($PID_FILE)"
27+
exit 0
28+
fi
29+
30+
cat "$PID_FILE" | while read -r pid; do
31+
if [[ -n "$pid" ]]; then
32+
if [[ "$OS" =~ Windows|windows ]]; then
33+
powershell -NoProfile -Command "Stop-Process -Id $pid -Force" 2>$null || \
34+
echo "PID $pid already gone"
35+
else
36+
kill "$pid" 2>/dev/null || echo "PID $pid already gone"
37+
fi
38+
fi
39+
done
40+
41+
rm -f "$PID_FILE"

evergreen/evergreen.yml

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -833,34 +833,6 @@ functions:
833833
- "OS"
834834
args:
835835
- evergreen/cleanup-test-resources.sh
836-
- command: shell.exec
837-
params:
838-
shell: "bash"
839-
script: |
840-
#This script kills the test SOCKS5 proxy servers.
841-
#The server processes have almost certainly already been killed by the evergreen process cleaning though.
842-
#This is just to be sure it already happened and delete the file containing the saved PIDs.
843-
844-
echo "Killing proxies"
845-
PID_FILE="socks5_pids.txt"
846-
847-
if [[ ! -f "$PID_FILE" ]]; then
848-
echo "No PID file found ($PID_FILE)"
849-
exit 0
850-
fi
851-
852-
cat "$PID_FILE" | while read -r pid; do
853-
if [[ -n "$pid" ]]; then
854-
if [[ "$OS" =~ Windows|windows ]]; then
855-
powershell -NoProfile -Command "Stop-Process -Id $pid -Force" 2>$null || \
856-
echo "PID $pid already gone"
857-
else
858-
kill "$pid" 2>/dev/null || echo "PID $pid already gone"
859-
fi
860-
fi
861-
done
862-
863-
rm -f "$PID_FILE"
864836

865837
fix-absolute-paths:
866838
- command: shell.exec

0 commit comments

Comments
 (0)