March 9th, 2013, 01:51 AM
Sleep command in background
I am trying to
1) start the command "sleep 6000" in the background
2) use ps to determine its status
3) redirect the ps command to a file
4) kill the sleep process
5) run ps to verify the process is dead.
I am not asking for the answer, but just someone more versed in UNIX to see if what I am doing is correct. Here are my steps thus far:
1. sleep 6000 &
2 + 3. ps > /var/home/stud3/myname/myfile
4. kill 61040 PID (61040 was the PID and I read I had to type PID after the numerical value)
March 9th, 2013, 10:31 PM
Not sure what the + 3. bit is, but the way I'd do it is:
Penny dropped on the + 3. .. d'oh! That's what trying to think at 3:30 in the morning does for you
sleep 6000 &
ps -fp $pid > /var/home/stud3/myname/myfile
ps -fp $pid
Last edited by SimonJM; March 9th, 2013 at 10:34 PM.
Reason: Comprehension despite being over-tired! ^_^
The moon on the one hand, the dawn on the other:
The moon is my sister, the dawn is my brother.
The moon on my left and the dawn on my right.
My brother, good morning: my sister, good night.
-- Hilaire Belloc