Linux: Check process restarted

To check whether a process was restarted, look ‘/var/run/{process name}.pid’ file’s timestamp.

# before
% ll /var/run/apache2/apache2.pid
-rw-r--r-- 1 root root 5  March 22 11:10 /var/run/apache2/apache2.pid

# restart
% sudo service apache2 restart
 * Restarting web server apache2 

# the timestamp has updated
% ll /var/run/apache2/apache2.pid 
-rw-r--r-- 1 root root 5  March 22 11:25 /var/run/apache2/apache2.pid

 

Leave a Reply

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