aboutsummaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2013-03-16 00:24:24 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2013-03-16 14:15:50 +0100
commite45fc8635926f70b0e19d5214f1f8b8fd06068aa (patch)
treec8623507ffc51331484e4ed8b9c4478acb34d09b /contrib
parent54dd949e623d2f9535e30d450c198d15e5e98e91 (diff)
respawn: Adjust the oom score for the supervisor and bts/pcu, increase sleep
Make the script mostly unkillable due to OOM and make sure that the process has a score of zero. Wait 10 seconds before re-launching. The combination of ( && exec ) & appears to save one sub-process. The script has been tested with bash and busybox's ash.
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/respawn-only.sh10
-rwxr-xr-xcontrib/respawn.sh12
2 files changed, 20 insertions, 2 deletions
diff --git a/contrib/respawn-only.sh b/contrib/respawn-only.sh
index 4f611dd2..66aaac79 100755
--- a/contrib/respawn-only.sh
+++ b/contrib/respawn-only.sh
@@ -1,4 +1,12 @@
#!/bin/sh
+
+PID=$$
+echo "-1000" > /proc/$PID/oom_score_adj
+
+
while [ -f $1 ]; do
- nice -n -20 $*
+ (echo "0" > /proc/self/oom_score_adj && exec nice -n -20 $*) &
+ LAST_PID=$!
+ wait $LAST_PID
+ sleep 10s
done
diff --git a/contrib/respawn.sh b/contrib/respawn.sh
index 0798a47a..44e4fdc3 100755
--- a/contrib/respawn.sh
+++ b/contrib/respawn.sh
@@ -1,6 +1,16 @@
#!/bin/sh
+
+PID=$$
+echo "-1000" > /proc/$PID/oom_score_adj
+
while [ -e /etc/passwd ]; do
+ cat /lib/firmware/sysmobts-v?.bit > /dev/fpgadl_par0
+ sleep 2s
cat /lib/firmware/sysmobts-v?.out > /dev/dspdl_dm644x_0
+ sleep 1s
echo "0" > /sys/class/leds/activity_led/brightness
- nice -n -20 $*
+ (echo "0" > /proc/self/oom_score_adj && exec nice -n -20 $*) &
+ LAST_PID=$!
+ wait $LAST_PID
+ sleep 10s
done