worker_script
#!/bin/bash
# TIME=`date "+%Y-%m-%d %X"`
scriptName=$@
timeout=300
interval=30
delay=2
(
((t = timeout))
while ((t > 0)); do
sleep $interval
kill -0 $$ || exit 0
((t -= interval))
done
kill -s SIGTERM $$ && kill -0 $$ && echo "process died" || exit 0
sleep $delay
kill -s SIGKILL $$
) 2> /dev/null &
$@