aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/respawn-only.sh
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/respawn-only.sh')
-rwxr-xr-xcontrib/respawn-only.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/contrib/respawn-only.sh b/contrib/respawn-only.sh
new file mode 100755
index 00000000..478abd66
--- /dev/null
+++ b/contrib/respawn-only.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+PID=$$
+echo "-1000" > /proc/$PID/oom_score_adj
+
+trap "{ kill 0; kill -2 0; }" EXIT
+
+while [ -f $1 ]; do
+ (echo "0" > /proc/self/oom_score_adj && exec nice -n -20 $*) &
+ LAST_PID=$!
+ wait $LAST_PID
+ sleep 10s
+done