I just want to run a shell scrip at say this exact time "16:22:36". utilities like "at" are useless since they don't have "seconds". "sleep" does not work since the loop is ending 8 hours ahead of time for some reason :s , I have searched all over google and couldn't find any tools. so a huge Os like Linux doesn't have a proper task scheduler?
相关问题
- Is shmid returned by shmget() unique across proces
- how to get running process information in java?
- Error building gcc 4.8.3 from source: libstdc++.so
- Why should we check WIFEXITED after wait in order
- Null-terminated string, opening file for reading
The standard
cron
lacks second precision scheduling becauseHowever with the help of
sleep(1)
from GNU Coreutils suite, you can achieve true second precision job scheduling.Example: wait for 12:14:05 and 12:14:10
(wait for a while...)
As you see from the 1st version,
14 12
incrontab
does not guarantee12:14:00
sharp. The 2nd version useswhile
loop and sub-secondsleep(1)
to achieve sub-second precision.Note that, unless you use NTP to synchronize your machine clock to time servers, it is meaningless to talk about second precision job scheduling.
Linux has a wonderful task scheduler, called
crontab
. There is a wealth of info about it on the web. As a simple "this is what it does and how to use it" though: http://kvz.io/blog/2007/07/29/schedule-tasks-on-linux-using-crontab/ - Should get you started.You could create a
crontab
entry for the hour and minute with a sleep of 36 seconds