LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 02-05-2007, 12:46 AM   #1
minike
Member
 
Registered: Aug 2004
Location: Argentina
Distribution: slackware 12
Posts: 211

Rep: Reputation: 30
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 in advance
 
Old 02-05-2007, 03:09 AM   #2
pdw_hu
Member
 
Registered: Nov 2005
Location: Budapest, Hungary
Distribution: Slackware, Gentoo
Posts: 346

Rep: Reputation: Disabled
You can use:
at - executes commands at a specified time.
 
Old 02-05-2007, 10:09 AM   #3
minike
Member
 
Registered: Aug 2004
Location: Argentina
Distribution: slackware 12
Posts: 211

Original Poster
Rep: Reputation: 30
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)

any idea will be welcome.
 
Old 02-05-2007, 10:14 AM   #4
pdw_hu
Member
 
Registered: Nov 2005
Location: Budapest, Hungary
Distribution: Slackware, Gentoo
Posts: 346

Rep: Reputation: Disabled
Ya RLY
Sorry my bad for not reading it carefully. Can't help you in that case tho
 
Old 02-05-2007, 06:35 PM   #5
H_TeXMeX_H
Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269
Quote:
Originally Posted by pdw_hu
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.
http://www.die.net/doc/linux/man/man1/at.1.html
 
Old 02-06-2007, 04:28 AM   #6
malo_umoran
Member
 
Registered: Dec 2003
Distribution: Desktop: Slackware 13.1 &13.37 | Server: Debian 6.0
Posts: 270

Rep: Reputation: 32
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.

M.
 
Old 02-06-2007, 06:01 AM   #7
minike
Member
 
Registered: Aug 2004
Location: Argentina
Distribution: slackware 12
Posts: 211

Original Poster
Rep: Reputation: 30
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)

cheers
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Howto switch off harddisc because of inactivity m-blaster Linux - Hardware 1 06-11-2006 02:13 PM
Help please - "#exec cmd" stops working after downloading to Windows crabjoe Linux - Newbie 3 02-15-2006 01:08 PM
exec cmd=perl... work but exec cgi doenst crions Slackware 5 12-09-2005 12:17 PM
Cmd that shows which config files are for target exec? oasisbhrnw99 Linux - General 2 09-05-2005 10:58 PM
how to change system time? date cmd? servnov Linux - Newbie 2 10-31-2004 03:07 PM


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration