my $fullcmd="nohup sh -c \"($cmd)\" &"; debug(DWRN, "Process is not running, attempting to restart using '$fullcmd'\n"); qx/$fullcmd/; debug(DDBG, "Process is restarted, next poll in $interval seconds\n"); #### ~$ perl bin/restart_app --cmd "sleep 5" -vvv "sleep" ...... 17:14:49 D1 Process is not running, attempting to restart using 'nohup sh -c "(sleep 5)" &' 17:14:54 D2 Process is restarted, next poll in 2 seconds ...... #### my $finish = time + $run; my $restarts=0; while($finish > (my $last = time)) { my $next = $last + $poll; unless(is_running()) { my $fullcmd="nohup sh -c \"($cmd)\" &"; system($fullcmd); }