How to find out if a working Linux computer is idle or not

I have my laptop, most of the time connected to the Internet, Internet speed is pretty slow. When I upload some large files, I can’t search websites because of the slow internet speed. My plan is to write a bash script and run it in cron jobs, when it detects that the system is inactive, then it starts the process (a process that will download large files, preferably wget) automatically, and when I use a laptop the process is destroyed . Like the splash screen (I found several ways in Planning on Linux: run the task when the computer is idle (= without user input)but I don’t use the screensaver on my machine nor do I want to depend on a gnome application such as xscreensaver). I am using Ubuntu linux, is there any way to find the correct downtime of Linux mahine.

idle = no keyboard, touchpad, or mouse clicks.

Is there a way to find network activity this way, for example, if they do not have Internet traffic, then my script will start executing another wget script, and if my browser requests web pages, it will stop the script.

please suggest me the correct way. Should I implement it using downtime, it will be more efficient if I consider network traffic.

+5
source share
2 answers

, . ( /dev ).

, :

sudo cat /dev/input/by-path/platform-i8042-serio-0-event-kbd

, ( ), . , .

, chgrp (). - root! , , dev. , .

( , , ) - xscreensaver ( ) ( , , ).

+3

: wget, , .

:

wget --limit-rate=1.5k http://example.com
0

All Articles