sleep 1 while kill(0, $pid) && $timeout--; kill 3, $pid if $timeout;