howto exec a cmd after certain time of inactivity?
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
howto exec a cmd after certain time of inactivity?
hi, I'm traying to find out how to trigger a command after X minutes (exactly as a screensaver do) .. I thought it could be possible from xorg.conf, but.. those settings are just for blanking the screen, not for anything.
I also reviewed the xscreensaver app, but didn't find in it an option like "use this screensaver" where to add the command.
so, what I'm looking for is a way to use kinda "screen-saver engine" ..or something that allows me to trigger a command after certain inactivity time. (I need it just under X, no need to work in console).
if there is a way or app already within slack, the better.
anyway, if it's needed to add some proggy, I'll try it out.
thanks 4 taking your time to answer..
but -til I know, `at` do not execute commands after certain time of inactivity, just do it after an exact amount of time given by the user.
what I'm looking 4 is something like the "first part" of a screensaver application (the part in where inactivity is measured)
Ya RLY
Sorry my bad for not reading it carefully. Can't help you in that case tho
No, actually, you were right in the first place:
Quote:
Originally Posted by man at
batch
executes commands when system load levels permit; in other words, when the load average drops below 0.8, or the value specified in the invocation of atrun.
This script runs a command when a xscreensaver locks or blanks desktop. Something similar can be easily made for gnome-screensaver:
Code:
#!/usr/bin/perl -w
use strict;
delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
$ENV{'PATH'} = '/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin';
$<=0; # become root not just effective root
open(XS,"/usr/bin/xscreensaver-command -watch|") or die;
while(<XS>) {
## do something when screensaved blanks the desktop
if(/^BLANK/i) {
system("/run/this/command");
## do something after unblanking
} elsif(/^UNBLANK/i) {
system("/run/this/command");
## do something when screen is locked
} elsif(/^LOCK/i) {
system("/run/this/command");
}
## do something when screen is unlocked
} elsif(/^UNLOCK/i) {
system("/run/this/command");
}
}
Just set up you xscreensaver to lock or blank the screen after X minutes of inactivity.
You have to put the script in autostart of you desktop environment (for Gnome: in Sessions Manager). It should be run every time when X is started or you logged in.
very thanks 4 the answers.
I solved doing this:
I opened the xscreensaver control-gui, looked 4 a screensaver entry unusable; selected it and in its (advanced) properties, deleted it name and put in its place the command I needed.
this way works just fine ..but blanks the screen! -nothing is perfect, uh?
think it's the easiest way to do the job.
(about the "at" command:
right, there's something called "batch"..
but I've never been able to make the 'at' command work-I give up using it long time ago)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.