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.
This commit is contained in:
Holger Hans Peter Freyther 2013-03-16 00:24:24 +01:00
parent 54dd949e62
commit e45fc86359
2 changed files with 20 additions and 2 deletions

View File

@ -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

View File

@ -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