Find out uptime of server and MySql database

This site had been unstable for the last couple of weeks, due to my hosting company’s issues with servers. My Apache and MySql database have both been moved to a different server. Hopefully things will be stable from now on.

During the troubleshooting time, I used a few commands to find out the uptime of both server and MySql database. I thought these would be helpful to other people so here they are.

To find out the uptime of your Linux server, any one of the following commands will do:
w
uptime
top

To find out the uptime of your mysql demon, log into the server using mysql command line, then issue the following command:
\s

I am sure there is a way to find out how long Apache has been running, but I just don’t know. Can anybody enlighten me? Thanks.

3 thoughts on “Find out uptime of server and MySql database”

  1. To find when apache was last restarted (came here as was looking for the same thing!), look at the httpd.pid file, which is is in /etc/httpd/run/ (which on our system is symlinked somewhere else), as apache rights this file when it starts.

    Hope that helps, (but you almost certainly know the answer by now, but might help others)

  2. Thanks a lot Barry.

    No, I haven’t figured out how to do it. Thanks for sharing!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.