以下是who -u
命令的输出:
xenoadmin :0 2015-10-12 11:04 ? 2881 (:0)
xenoadmin pts/11 2015-10-12 11:04 old 3744 (:0)
xenoadmin pts/13 2015-10-12 12:39 old 3744 (:0)
xenoadmin pts/21 2015-10-15 19:15 old 3744 (:0)
xenoadmin pts/22 2015-10-15 12:19 . 3744 (:0)
xenoadmin pts/23 2015-10-15 12:29 00:57 3744 (:0)
xenoadmin pts/24 2015-10-15 12:30 old 3744 (:0)
xenoadmin pts/25 2015-10-15 12:30 old 447 (localhost)
xenoadmin pts/29 2015-10-21 16:52 old 3744 (:0)
在空闲时间列中,“旧”和“?”是什么意思。我正在编写一个小脚本,用于捕获 ssh 空闲会话,如果它们空闲时间超过,则终止它们;我不确定如何处理这些值(“旧”和“?”)
谢谢
答案1
它记录在info
页面中。来自info who
:
‘-u’
After the login time, print the number of hours and minutes that the user has been idle. '.' means the user was active in the last minute. 'old' means the user has been idle for more than 24 hours.
此外,?
对于 X 会话,显示数字 ( :0
) 可确认。就 X 会话而言,预计不存在空闲时间,因此值为?
(未知)。