uptime
This is an old revision of the document!
−Table of Contents
Process Uptime
Find the process ID of the master (parent process), then:
1 |
ls -ld /proc/3380 |
1 |
dr-xr-xr-x 8 root root 0 Nov 12 23:05 /proc/3380 |
1 |
ps -eo user,pid,cmd,etime,ppid | grep apache |
1 |
ps -eo user,pid,cmd,etime | grep service |
1 2 3 4 5 6 7 8 9 |
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:
1 |
3380 nginx: master process /usr/ 1-02:50:02 |
Server uptime
1 |
w |
1 |
uptime |
Apache uptime
CentOS
1 |
service httpd fullstatus |
Ubuntu
1 |
apache2ctl fullstatus |
Sometimes the correct packages are not installed to run these commands
Alternative:
1 |
grep -i resuming /var/log/httpd/error .log |
1 |
grep -i resuming /var/log/apache2/error .log |
mysql uptime
You can use any of the following commands
1 |
mysqladmin version | grep -i uptime |
1 |
SHOW GLOBAL STATUS LIKE 'Uptime' ; |
or
1 |
mysql -e 'SHOW GLOBAL STATUS LIKE "Uptime"' | grep '' [[:digit:]] '' | awk '{ print $2 / 60 / 60 / 24 " days"}' |
uptime.1453880865.txt.gz · Last modified: 2024/05/23 07:26 (external edit)