aptosid.com

Software - question: what's the best way to schedule something every 5s

timrichardson - 17.12.2010, 08:05
Post subject: question: what's the best way to schedule something every 5s
Hi. I'd like to run something every five seconds (xrandr -q) under my user id (not root). What's the best way to do that?
towo - 17.12.2010, 08:50
Post subject: RE: question: what
at?
cron?
lotman - 17.12.2010, 09:29
Post subject: RE: question: what
I think a short script with a loop, pausing 5 seconds via sleep is the best way to go. Cron can only start something every 1 minute and you probably don't want 17280 at-jobs a day *smile*

lotman
timrichardson - 17.12.2010, 09:36
Post subject: RE: question: what
ok ...

Meanwhile, I discover that there is a module in kde called kephal which is supposed to poll for xrandr changes.
Somehow, it got turned off. (it doesn't work with nvidia drivers but it should work with intel hardware)
polling is controlled in ~/.local/screen-configurations.xml
and can also be set with
      Code:

qdbus org.kde.kded /modules/kephal/Configurations setPolling true

which apparently polls every 10 seconds (no configuration possible for the period of polling).
sx9 - 18.12.2010, 22:31
Post subject: RE: question: what
A very simple example script how lotman has described it, could look like this:

      Code:

#!/bin/bash

i=0
while [ "$i" == 0 ]
do
 xrandr -q
 sleep 5
done

All times are GMT - 12 Hours
Powered by PNphpBB2 © 2003-2010 The Zafenio Group
Credits