How to check the uptime of Apache/httpd service?

Apache uptime.

It’s simple. But most of the admins are not aware about these commands.

We can check the uptime status of Apache service by different ways. Here I’m explaining some of them with examples.

As we know about Apache, it’s a commonly using web-server for Linux server. It’s completely open source and easy to customize.

Several online UPTIME monitoring tools are available now-a-days. We already discussed about some top most tools on this topic >> Top website or server uptime or downtime online monitoring tools << Please go through this post if you are planning to monitor your website using some online tools.

We can check the Apache uptime from the “fullstatus” itself. Please log into the server as root and execute the following command:

1. SSH as root.
2. Execute:

httpd fullstatus|grep -i uptime

Try “apachectl” too instead of httpd…

Sample output

[~]# httpd fullstatus|grep -i uptime
   Server uptime: 13 days 3 hours 47 minutes 23 seconds

It’s simple!! The server uptime can be checked from the command “uptime.”

Another way, it’s from the command PS. It’s process level.

The command PS on the server report a snapshot of the current processes running on the server. So, definitely, the PS can tell us something about the Apache service’s start up time. Here the trick goes!

We can use the following options with PS command, comm, etime and user. The “comm” parameter displays command executing, “etime” shows total time elapsed that command and the “user” filed tell us about the users involved with that command or processes. Here we goes with the following command:

ps -eo comm,etime,user | grep httpd

In the above, grep out the process started by ROOT user. For that, use the following command:

ps -eo comm,etime,user | grep httpd | grep root

See the sample output

[~]# ps -eo comm,etime,user | grep httpd|grep root
httpd           26-13:14:41 root

Which means 26 days, 13 hours, 14 minutes and 41 seconds 🙂

After a restart, the results became as follows:

# ps -eo comm,etime,user | grep httpd|grep root
httpd                 00:37 root
# httpd fullstatus|grep -i uptime
   Server uptime: 33 seconds

That’s it!! Go ahead 🙂

, ,

Post navigation

Arunlal A

Senior System Developer at Zeta. Linux lover. Traveller. Let's connect! Whether you're a seasoned DevOps pro or just starting your journey, I'm always eager to engage with like-minded individuals. Follow my blog for regular updates, connect on social media, and let's embark on this DevOps adventure together! Happy coding and deploying!

3 thoughts on “How to check the uptime of Apache/httpd service?

  1. Your blog is very nice thanks for sharing Then just very nice, thanks for sharing with us Enjoyed every bit of your blog.Really looking forward to reading more, Tech News UK breaking news and analysis on computing, the web, blogs, games, gadgets, social media, broadband and more.

Leave a Reply

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