You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
414 B
22 lines
414 B
#!/bin/sh
|
|
|
|
trap "kill 0" EXIT
|
|
|
|
SLEEP_BEFORE_RESPAWN=${SLEEP_BEFORE_RESPAWN:-0}
|
|
|
|
i=0
|
|
max_i=500
|
|
while [ $i -lt $max_i ]; do
|
|
echo "$i: starting: $*"
|
|
$* &
|
|
LAST_PID=$!
|
|
wait $LAST_PID
|
|
echo "$i: stopped pid $LAST_PID with status $?"
|
|
if [ $SLEEP_BEFORE_RESPAWN -gt 0 ]; then
|
|
echo "sleeping $SLEEP_BEFORE_RESPAWN seconds..."
|
|
sleep $SLEEP_BEFORE_RESPAWN
|
|
fi
|
|
i=$(expr $i + 1)
|
|
done
|
|
echo "exiting after $max_i runs"
|