Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How Can I see how long a service is runing?

Status
Not open for further replies.

ilkertanli

Programmer
Jun 9, 2004
21
US
Hi;

I have created a cronjob to restart couple of services on my linux server. I would like to check if it is working or not and also for how long are my services runing.

Thanks,

--ilker
 
If you wanted to see how long sshd was running, try

Code:
ps waux | grep -i sshd

I get output like this:
"root 3644 0.0 0.1 3988 1556 ? Ss Apr19 0:00 /usr/sbin/sshd"

The third to last column contains either a time (from today) or a date (prior to today) describing when the daemon was started.

work for you?

D.E.R. Management - IT Project Management Consulting
 
Also you can use ps -o etime <pid> to see the elapsed time it has been running.

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top