==== Process Uptime ====
Find the process ID of the master (parent process), then:
ls -ld /proc/3380
Output looks like:
dr-xr-xr-x 8 root root 0 Nov 12 23:05 /proc/3380
or
ps -eo user,pid,cmd,etime,ppid | grep http
ps -eo user,pid,cmd,etime,ppid | grep service
Show JUST the master process:
ps -eo user,pid,cmd,etime,ppid | grep -v grep | grep http | grep root
Output is simlar:
3380 nginx: master process /usr/ 1-02:50:02
8543 nginx: worker process 02:50:10
8544 nginx: worker process 02:50:10
8545 nginx: worker process 02:50:10
8546 nginx: worker process 02:50:10
8547 nginx: worker process 02:50:10
8548 nginx: worker process 02:50:10
8549 nginx: worker process 02:50:10
8550 nginx: worker process 02:50:10
The bit we are interested in is the master process:
3380 nginx: master process /usr/ 1-02:50:02
This represents 1 days, 2 hours, 50 mins and 2 seconds
\\
\\
------------------------
==== Server uptime ====
w
uptime
\\
\\
------------------------
==== Apache uptime ====
\\
CentOS
service httpd fullstatus
Ubuntu
apache2ctl fullstatus
\\
Sometimes the correct packages are not installed to run these commands
\\
Alternative:
grep -i resuming /var/log/httpd/error.log
grep -i resuming /var/log/apache2/error.log
\\
\\
------------------------
==== mysql uptime ====
\\
You can use any of the following commands
mysqladmin version | grep -i uptime
or
SHOW GLOBAL STATUS LIKE 'Uptime';
or
mysql -e 'SHOW GLOBAL STATUS LIKE "Uptime"' | grep ''[[:digit:]]'' | awk '{ print $2 / 60 / 60 / 24 " days"}'