Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
At command to only run when programmed +- 1 minute
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
javeree_work
Tux's lil' helper
Tux's lil' helper


Joined: 13 Apr 2005
Posts: 84

PostPosted: Wed Jan 31, 2007 1:58 pm    Post subject: At command to only run when programmed +- 1 minute Reply with quote

I program recordings of TV shows using the at command. Sometimes, my PC is off even when a recording is planned. However, when I turn the PC back on a few hours or days later, the recording I missed starts almost immediately. This is of course not what I intended, and may interfere with other planned recordings. Is there a way to have at only start the command when it is actually the time it was programmed for (say within a five minute range), and not the first time it runs after when it was planned ?

If this is not possible, would it be difficult to program in bash a check that says 'If I'm started between that and that time, continue, otherwise, just stop.'
Back to top
View user's profile Send private message
Jeremy_Z
l33t
l33t


Joined: 05 Apr 2004
Posts: 671
Location: Shanghai

PostPosted: Thu Feb 01, 2007 1:52 am    Post subject: Reply with quote

Hi, i not know about at too much but it would be trivial to add a date check in the bash script.
_________________
"Because two groups of consumers drive the absolute high end of home computing: the gamers and the porn surfers." /.
My gentoo projects, Kelogviewer and a QT4 gui for etc-proposals
Back to top
View user's profile Send private message
javeree_work
Tux's lil' helper
Tux's lil' helper


Joined: 13 Apr 2005
Posts: 84

PostPosted: Tue Feb 06, 2007 11:07 am    Post subject: Reply with quote

The problem with doing such a test is how to know when the script should have been started in the first place.

If I program at to call a script at say 10.00 and due to a reboot, at triggers only at 12.00, the script should say 'I am triggered and it is now 12.00, please at-command, tell me when triggering me was actually planned, so I can compare.

Unfortunately, by the time the script can try to interact with at, this info is already gone.

Secondly, I would like the script generic enough so that it works the same regardless if I start it manually, with cron or with at.

Of course I can start inventing things like storing this information somewhere at the moment when I program at to call the script, and then have the script refer to that storage location. This just doesn't feel very unix-like. I would think that 'let everyone do one thing best' would rather shift this kind of functionality towards at. I just thought that maybe there was a variant of at that behaved like that (just like anacron is a variant of cron).
Back to top
View user's profile Send private message
Jeremy_Z
l33t
l33t


Joined: 05 Apr 2004
Posts: 671
Location: Shanghai

PostPosted: Tue Feb 06, 2007 12:20 pm    Post subject: Reply with quote

Humm yes but i did not find any information on at and reboot issues. My guess it that AT just try to exc your command from the given time, which could be very long if you happened to shutdown your machine before the job could start.

So, if i were you i would just implement a "at cleaner" script to run on startup, just find all AT jobs that are overdue (or overdue by a given margin) and delete them. Just a matter of atq, awk and atrm.
_________________
"Because two groups of consumers drive the absolute high end of home computing: the gamers and the porn surfers." /.
My gentoo projects, Kelogviewer and a QT4 gui for etc-proposals
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum