Linux at command with seconds precision

4

0

I'm looking for some Linux command which may launch another command at a specific time.

I know about the at command, but it gives me only minutes precision, and I need seconds precision. Is there an option with at command that I'm not aware of? Or is there any other command I should use?

Any orientation will be useful.

Javier Novoa C.

Posted 2011-06-25T04:57:52.547

Reputation: 165

2Why? If a scheduler checked every second then it would eat up tons of processor. Why isn't minute precision good enough? – beatgammit – 2011-06-25T05:03:02.000

You'll have to suffer with a little lack of precision - my results to time sleep 5 give me an extra .003 seconds. Try that command on your machine to see how accurate it will be. – new123456 – 2011-06-25T16:52:41.900

@tjameson , because I need to schedule something for 5 seconds or so, and the at command doesn't works for me. I wasn't going for the sleep command, but I guess I'll have to do with it. Thanks – Javier Novoa C. – 2011-06-25T22:21:53.663

Answers

7

Use cron to run a script that calls the sleep command for the sub-miniute precision bit of it? So

sleep 10 ; foo.sh 

should run foo.sh 10 seconds after the command is called.

Journeyman Geek

Posted 2011-06-25T04:57:52.547

Reputation: 119 122

Do you know anything about its precision? Or the precision of at in executing something at exactly xx:xx:00:000? If the user requires this kind of precision, it's conceivable that at and sleep won't cut it. – Daniel Beck – 2011-06-25T09:36:32.540

sleep on ubuntu and as such debian accepts floating point values. "Unlike most implemenatations that require NUMBER be an integer, here NUMBER may be an arbitrary floating point number." However, if he needs smaller than whatever precision float supports... i have no clue – Journeyman Geek – 2011-06-25T09:41:40.313

I meant more along the lines of whether his script actually will start exactly at :10 when he specifies sleep 10, or maybe more like :11 or :12... – Daniel Beck – 2011-06-25T10:20:53.130

no idea, actually. i've mostly seen wait used as a 'lets give things a while to settle down' way, rather than as a precision timing instrument. – Journeyman Geek – 2011-06-25T10:24:00.807

Bog standard linux is not a real time system and offers no absolute timing guarantees. Get it heavily loaded and thrashing and things can become very delayed, indeed. *// too much experience with systems that have nearly enough memory* – dmckee --- ex-moderator kitten – 2011-06-25T13:27:15.127