当前位置: 技术问答>linux和unix
求助:linux使用ps -ef查看进程有误
来源: 互联网 发布时间:2016-11-07
本文导语: 使用ps -ef |grep sep |grep -v grep 查看sep进程 一般情况下是这种结果: bill1 422078 1 0 09:09:31 - 0:00 sep -n 302 0 bill1 831706 1 0 09:09:31 - 0:00 sep -n 292 0 bill1 ...
使用ps -ef |grep sep |grep -v grep 查看sep进程
一般情况下是这种结果:
bill1 422078 1 0 09:09:31 - 0:00 sep -n 302 0
bill1 831706 1 0 09:09:31 - 0:00 sep -n 292 0
bill1 835604 1 0 09:09:31 - 0:00 sep -n 300 0
但是有时候会出现这种情况:
bill1 1003754 1 0 Feb 12 - 0:00 sep -n 309 0
bill1 1024182 1 0 Feb 12 - 0:00 sep -n 302 0
bill1 1044638 1 0 Feb 12 - 0:00 sep -n 300 0
bill1 1048644 1 0 Feb 12 - 0:00 sep -n 298 0
为什么这个时间显示的格式会有变化,原来是09:09:31,有时候突然变成了Feb 12,将这个进程杀掉,重启,又是09:09:31了。
求真相。
一般情况下是这种结果:
bill1 422078 1 0 09:09:31 - 0:00 sep -n 302 0
bill1 831706 1 0 09:09:31 - 0:00 sep -n 292 0
bill1 835604 1 0 09:09:31 - 0:00 sep -n 300 0
但是有时候会出现这种情况:
bill1 1003754 1 0 Feb 12 - 0:00 sep -n 309 0
bill1 1024182 1 0 Feb 12 - 0:00 sep -n 302 0
bill1 1044638 1 0 Feb 12 - 0:00 sep -n 300 0
bill1 1048644 1 0 Feb 12 - 0:00 sep -n 298 0
为什么这个时间显示的格式会有变化,原来是09:09:31,有时候突然变成了Feb 12,将这个进程杀掉,重启,又是09:09:31了。
求真相。
|
分拣程序?
当天运行的程序,显示时间
之前运行的程序,显示日期
貌似这个规律
当天运行的程序,显示时间
之前运行的程序,显示日期
貌似这个规律
|
如果这个进程启动的时间超过(24 - 启动时间) 的话,就会显示启动的日期(具体到天)
如果这个进程是当天启动的, 则显示启动时间(时分秒)
也就是如果不是当天启动的则会显示日期, 如果是当天的则会显示时间
如果这个进程是当天启动的, 则显示启动时间(时分秒)
也就是如果不是当天启动的则会显示日期, 如果是当天的则会显示时间
|
这是ps自己的实现,感觉没有办法
|
Get_Local_Time !systime.h...
|
man ps
-o Format
Displays information in the format specified by the Format variable. Multiple field specifiers can be specified for
the Format variable. The Format variable is either a comma-separated list of field specifiers or a list of field
specifiers enclosed within a set of " " (double-quotation marks) and separated from one another by a comma or by one
or more spaces, or both.
Each field specifier has a default header. The default header can be overridden by appending an = (equal sign)
followed by the user-defined text for the header. The fields are written in the order specified on the command line in
column format. The field widths are specified by the system to be at least as wide as the default or user-defined
header text. If the header text is null, (such as if -o user= is specified), the field width is at least as wide as
the default header text. If all header fields are null, no header line is written.
看看似乎有办法指定输出格式呢?
或者读linux内核proc文件获取进程属性呢?
-o Format
Displays information in the format specified by the Format variable. Multiple field specifiers can be specified for
the Format variable. The Format variable is either a comma-separated list of field specifiers or a list of field
specifiers enclosed within a set of " " (double-quotation marks) and separated from one another by a comma or by one
or more spaces, or both.
Each field specifier has a default header. The default header can be overridden by appending an = (equal sign)
followed by the user-defined text for the header. The fields are written in the order specified on the command line in
column format. The field widths are specified by the system to be at least as wide as the default or user-defined
header text. If the header text is null, (such as if -o user= is specified), the field width is at least as wide as
the default header text. If all header fields are null, no header line is written.
看看似乎有办法指定输出格式呢?
或者读linux内核proc文件获取进程属性呢?