~ salmonella-environment-setup (master) afb1892da00bc11fd3bb3d0d05ea41d006361a89
commit afb1892da00bc11fd3bb3d0d05ea41d006361a89
Author: Mario Domenech Goulart <mario@parenteses.org>
AuthorDate: Tue Aug 29 19:02:09 2017 +0200
Commit: Mario Domenech Goulart <mario@parenteses.org>
CommitDate: Tue Aug 29 19:02:09 2017 +0200
salmonella/hunt-scsh-defunct.sh: add script
This script is run from the salmonella linux machines' cron every 10
minutes. It detects if a defunct process created by scsh-process'
tests is running and kill its parent. The defunct process blocks
salmonella until it is explicitly killed.
diff --git a/hunt-scsh-defunct.sh b/hunt-scsh-defunct.sh
new file mode 100755
index 0000000..3f5b679
--- /dev/null
+++ b/hunt-scsh-defunct.sh
@@ -0,0 +1,11 @@
+#! /bin/bash
+
+stuck=$(ps faux | grep -B1 '<[d]efunct>' | head -n1)
+
+if echo "$stuck" | grep -q "chicken/bin/csi -script run.scm"; then
+ pid_stuck=$(echo "$stuck" | awk '{print $2}')
+fi
+
+if [ -n "$pid_stuck" ] && grep -q '(use scsh-process)' /proc/"$pid_stuck"/cwd/run.scm; then
+ kill "$pid_stuck"
+fi
Trap