LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-30-2012, 02:44 PM   #1
Xeratul
Senior Member
 
Registered: Jun 2006
Location: UNIX
Distribution: FreeBSD
Posts: 2,658

Rep: Reputation: 255Reputation: 255Reputation: 255
How to detect that the pc is currently used (keyboard/mouse use)?


Hi,

I would like to use the pc over the ssh when no one is seated on the distant machine (CPU, ...). Not to disturb anyone.

How could, as user (no root), know that a person is sitting, using the mouse and keyboard, - sort to say working on the work station?

Who does not help much since the person could be logged in and having lunch, ...

Checking the mouse activity would be an idea, but it is not possible.Keyboard use neither.

Thank you
 
Old 08-30-2012, 04:58 PM   #2
Ygrex
Member
 
Registered: Nov 2004
Location: Russia (St.Petersburg)
Distribution: Debian
Posts: 666

Rep: Reputation: 68
usually `w` provides idle-time information per terminal; also you can monitor /dev/input/event* devices (if available) in order to catch terminal activity in real time
 
1 members found this post helpful.
Old 09-01-2012, 02:34 PM   #3
Xeratul
Senior Member
 
Registered: Jun 2006
Location: UNIX
Distribution: FreeBSD
Posts: 2,658

Original Poster
Rep: Reputation: 255Reputation: 255Reputation: 255
Quote:
Originally Posted by Ygrex View Post
usually `w` provides idle-time information per terminal; also you can monitor /dev/input/event* devices (if available) in order to catch terminal activity in real time
w sounds very good !!! thank you very much !!

maybe like this :
Code:
sleep 10s ; w | grep "w$" | awk ' { print $5  } '

I would say to monitor /dev/input/event* is more tricky + it might lead to cpu consuming.
I think about :
Code:
cat /dev... | while [ 1 ] ; do ... bla ; done

I know too xprintidle, but the problem is that is might be limited to x11 and not necesaarily in all conditions working.

Last edited by Xeratul; 09-01-2012 at 02:41 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to detect that no one is using the pc: not mouse, not keyboard after one hour? Xeratul Linux - General 3 01-31-2011 03:46 AM
Mouse interrupting keyboard events, can't type while mouse is moving sandaili Linux - Hardware 0 08-04-2008 06:56 PM
Bluetooth mouse and keyboard connect, mouse doesn't work BallsOfSteel Linux - Hardware 2 05-25-2008 01:09 AM
detect keyboard - no way ninguem_vj Linux - Hardware 3 09-25-2006 12:08 PM
USB mouse, keyboard, hid, console mouse problems jqcaducifer Linux - General 1 08-05-2003 09:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:23 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration