Process duration

Hi , How can I check that for a single process, for example pagent for how much duration this process was up or down and also I need multiple entries if this process was down or up multiple times. Please help.

Hello there,

I am not sure what exactly you trying to a accomplish, however, to know the duration for any task e.g to view a text file using cat use the command time before any task

time cat file.txt
Hello world
real    0m0.029s
user    0m0.004s
sys    0m0.000s

hope this helps

skip my answer and check MadeInGermany answer

If the process is still running you can query its elapsed time

ps -p PID -o etime

For measurement of service (daemon process) uptime/downtime you need a monitoring tool (nmon or zabbix or nagios or ...)

I hope the process logs the info somewhere in designated log directory. If that is the case, parse the log file, fetch start and end time and compute the diff.