Linux中的用户空闲时间 [英] User Idle time in Linux

查看:64
本文介绍了Linux中的用户空闲时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要检查自Linux(lucid-10.4)上一次用户输入出现(以python方式)以来经过了多少时间

I need to check how much time passed since last user input occurence (preffered way - in python) on Linux (lucid - 10.4)

我知道这在通常情况下很容易(仅使用XScreenSaverQueryInfo即可),但棘手的部分是我没有x11/extensions/scrnsaver.h标头,而且我不得不以其他方式做到这一点(即使我安装所需的程序包我无法在将运行该程序的其他100台计算机上安装程序包-我无权执行此操作.

I know that this is easy in normal way (just using XScreenSaverQueryInfo), but the tricky part is that I don't have x11/extensions/scrnsaver.h header and I HAVE to do that some other way (even if I install needed package I cannot install packeges on 100 other computers on which it will work - I don't have permission to do that).

推荐答案

在Internet部门中,我发现了类似的内容,并且看起来像在工作-但仍然不是完美的解决方案,因为它返回的信息远远超出了我的需要,而且适当值附近的数字不是恒定的(在其他系统中有所不同):

In deps of internet I found something like this, and it looks like working - but still not perfect solution because it returns much more info than I need and also the number near which is proper value is not constant (it differs in other system):

ls -l/dev/pts |fgrep用户名

这篇关于Linux中的用户空闲时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆