summaryrefslogtreecommitdiffstats
path: root/sup
blob: 9fad081374717231a0e085df9cc16de4bbc1b7de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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