Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
timrichardsonOffline
Post subject: question: what's the best way to schedule something every 5s  PostPosted: 17.12.2010, 08:05



Joined: 2010-09-12
Posts: 66
Location: Melbourne
Status: Offline
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?
 
 View user's profile Send private message Visit poster's website Yahoo Messenger  
Reply with quote Back to top
towoOffline
Post subject: RE: question: what  PostPosted: 17.12.2010, 08:50



Joined: 2010-09-13
Posts: 497
Location: Pößneck / Thüringen
Status: Offline
at?
cron?
 
 View user's profile Send private message  
Reply with quote Back to top
lotmanOffline
Post subject: RE: question: what  PostPosted: 17.12.2010, 09:29



Joined: 2010-09-12
Posts: 6
Location: berlin
Status: Offline
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
 
 View user's profile Send private message  
Reply with quote Back to top
timrichardsonOffline
Post subject: RE: question: what  PostPosted: 17.12.2010, 09:36



Joined: 2010-09-12
Posts: 66
Location: Melbourne
Status: Offline
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).
 
 View user's profile Send private message Visit poster's website Yahoo Messenger  
Reply with quote Back to top
sx9Offline
Post subject: RE: question: what  PostPosted: 18.12.2010, 22:31



Joined: 2010-09-12
Posts: 219
Location: Wiesbaden,Germany
Status: Offline
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

_________________
My new self-made computer:
Intel Core i7-2600k
ASUS Maximus IV Gene-Z (Mainboard)
2x4GB DDR3 RAM
ATI Radeon HD 6770
OCZ Vertex 3 60GB (SSD)
Western Digital Caviar Green WD20EARX 2TB (HDD)
...
aptosid x86_64
 
 View user's profile Send private message Send e-mail Yahoo Messenger  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT - 12 Hours
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by Zafenio