Command / Method to find the up-time of SSH server daemon & Nginx

5,155

Well there isn't really an uptime of openssh. you can check that it is active or how many connections it has. Or can grab the last time it was restarted by looking at /var/run/sshd.pid

ls -l /var/run/sshd.pid
-rw-r--r-- 1 root root 4 2012-12-15 21:26 /var/run/sshd.pid

That file is updated when the daemon starts/restarts. So you can calculate based on that.

For nginx you can install the status module (http://wiki.nginx.org/HttpStubStatusModule) and then use that to get some information, but alas uptime doesn't look to be there. Could probably use the same idea of looking at the nginx pid files, but that will just tell you since the last restart etc. and not 100% indicative of uptime.

Share:
5,155

Related videos on Youtube

Sandeep Raju Prabhakar
Author by

Sandeep Raju Prabhakar

Updated on September 18, 2022

Comments

  • Sandeep Raju Prabhakar
    Sandeep Raju Prabhakar almost 2 years

    I am looking for a method / Linux command to get the up-time of the open-ssh server and Nginx server running on my Ubuntu system. I want to know the up-time for calculating some internal statistics. I am looking for something similar to mysqladmin status command.

    Thanks