Find uptime of 'apache2'
来源:互联网 发布:打电话变女声软件 编辑:程序博客网 时间:2024/04/30 17:02
You can use ps -eo comm,etime
for example:
$ ps -eo comm,etime | grep httpdhttpd 5-01:40:22
This shows the elapsed time since the process was started. Mine is showing 5 days, 1 hr, 40 mins, 22 secs.
And after a restart:
$ ps -eo comm,etime | grep httpdhttpd 00:07
In a graceful restart, if an apache process is still serving a connection it won't be killed until it finishes, so if it's a large download to a slow host, it may linger for a while until it completes.
I did snip most of the output as it shows each forked process, but you will have a general overview of how long it has been running.
I suspect there are lots of apache-version-specific ways to do this, but one generally-valid (and slightly brute-force) way is as follows.
Find the PID of the process that has the port open; it will have been the first one started:
[root@lory ~]# netstat -apn|grep -w 80|grep LISTENtcp 0 0 :::80 :::* LISTEN 2903/httpd
The netstat
command requires privilege, so run as root or under sudo
. In this case the PID is 2903. Then find how long that process has been running:
[root@lory ~]# ps auxww|grep 2903|grep -v grepapache 2903 0.0 1.0 413316 39972 ? S Oct23 0:42 /usr/sbin/httpd
In this case, the start time is Oct 23, so I've been running a couple of days. You might get a field like 11:15, in which case it's a time of day, today, so you know the restart's worked.
- Find uptime of 'apache2'
- uptime
- uptime
- uptime
- Integration of weblogic8 & apache2
- uptime 之一 /proc/uptime
- /proc/uptime
- Linux---uptime
- uptime 续
- uptime 简介
- compile the mod_gsoap of apache2 for win32
- find: . changed during execution of find
- apache2
- apache2
- Apache2
- Find table of Invoice History
- find medium of two array
- Find Leaves of Binary Tree
- 程序员永远的痛之字符编码的奥秘
- 【分治】UVa 11129 An antiarithmetic permutation
- 西邮Linux兴趣小组13级纳新免试题浅析(上)
- asp.net,copy网页的代码去掉格式化代码前面的序号
- 小米路由为何要搭载搜狗预取引擎
- Find uptime of 'apache2'
- 安全图
- Floyd最短路径(多源最短路径)
- hadoop技术基本架构
- Python学习笔记(6)List and Keyboard Control
- 模版
- 对标准H264码流的RTP打包 VLC播放RTP打包发送的.264文件
- inner join on , left join on , right join on
- Linux服务器高性能编程——读书笔记(五)