#BASH
BASH Process Control
response=$(curl --write-out %{http_code} --silent --output /dev/null servername)
-
Start
<command>, assign the pid value to$PID, sleep forNminutes. Then end process$PID:<command> & PID=$! sleep ${N}m kill -HUP $PID
Something funky about that methed. My tests failed.
-
Asychronous version:
n=5 some_command & pid=$! at now + $n minutes <<<"kill -HUP $pid"
According to SO "The benefit of using at over waiting for sleep is that your script wont block waiting for the sleep to expire. You can go and do other things and at will asynchronously fire at the specified time. Depending on your script that may be a very important feature to have."
-
Info on
killa running process http://stackoverflow.com/questions/1624691/linux-kill-background-task) -
using a BASH wrapper. From: http://perplexed.co.uk/498_bash_pid_detection.htm