osmo-service-respawn: Add a shell script that spawns and respawns services

Adjust the oom_score_adj of the shell script to avoid ever beeing
killed. Adjust the score of the child and nice it. Sleep a given
interval before respawning it.

This script creates a .pid file so it can be used by a sysv init
script to stop the respawner and the client.
diff --git a/recipes-osmocom/osmo-service-respawn/files/osmo-service-respawn.sh b/recipes-osmocom/osmo-service-respawn/files/osmo-service-respawn.sh
new file mode 100755
index 0000000..e7274d4
--- /dev/null
+++ b/recipes-osmocom/osmo-service-respawn/files/osmo-service-respawn.sh
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+
+NAME=`basename $1`
+PIDFILE="/var/run/$NAME.pid"
+PID=$$
+echo "$PID" > $PIDFILE
+echo "-1000" > /proc/$PID/oom_score_adj
+
+trap "{ rm -f $PIDFILE ; kill 0; }" EXIT
+
+while true;
+do
+        echo "Restarting not dealing well with spaces.."
+        (echo "0" > /proc/self/oom_score_adj && exec $@) &
+        LAST_PID=$!
+        wait $LAST_PID
+        sleep 10s
+done
+