Re: Get running time of child process
On 20 Nov 2023 20:55 +0100, from martellif67@gmail.com (Franco Martelli):
> ~$ ps -eo pid,lstart,etime | grep 1620
> 1620 Mon Nov 20 16:12:47 2023 01:22:39
>
> 1620 is the PID of the parent process, the command returns the date when the
> parent process had started and the elapsed time as I expected. But if I do
> the same command for the its child process (PID 3507):
>
> ~$ ps -eo pid,lstart,etime | grep 3507
>
> the command returns nothing.
Try using ps -q instead of grep to get information on a specific PID:
$ ps -eo pid,lstart,etime -q 1620,3507
If that doesn't return anything for the child process, maybe it simply
has exited?
--
Michael Kjörling 🔗 https://michael.kjorling.se
“Remember when, on the Internet, nobody cared that you were a dog?”
Reply to: