I know that I can check a process's uptime with the following:
ps -o etime= -p "PID"
where PID = pid number.
I would like to write to a log when this process ends, and include it's uptime. The exact time it exits would be nice, but not strictly necessary. I have a script which automatically restarts it, but I am looking to increase it's stability. In this case, the process is ffmpeg. I am running a very low bandwidth stream from an unstable source, and the process frequently, intermittently fails.
I feel that if I could log it for a day or two, I could try different configurations to see if I can extend the uptime to an acceptable limit.
Thank you for your valuable insight!