summaryrefslogtreecommitdiffstats
path: root/sup
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xssn.at>2010-06-06 22:04:51 +0200
committerFlorian Pritz <bluewind@xssn.at>2010-06-06 22:04:51 +0200
commit3bbb7a400a253f776e60eff44a386c898eb8014d (patch)
tree4b03b61e87f632bcab97842a2c2d5e6a58afb427 /sup
parent30e977cc418e8e71a0e9da239573fae46990a45a (diff)
downloadbin-3bbb7a400a253f776e60eff44a386c898eb8014d.tar.gz
bin-3bbb7a400a253f776e60eff44a386c898eb8014d.tar.xz
add sup (simple supervisor)
Signed-off-by: Florian Pritz <bluewind@xssn.at>
Diffstat (limited to 'sup')
-rwxr-xr-xsup20
1 files changed, 20 insertions, 0 deletions
diff --git a/sup b/sup
new file mode 100755
index 0000000..9fad081
--- /dev/null
+++ b/sup
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+command="$*"
+
+cleanup() {
+ echo "killed... $pid"
+ kill $pid
+ exit
+}
+
+trap cleanup 2 15
+
+while :; do
+ echo -n "running... "
+ $command &
+ pid=$!
+ echo PID: $pid
+ wait $pid
+done
+