While trying to solve some Nagios issue, I remembered that there’s the „at“ command scheduler. It allows to execute a given command at a specified time. So, for example, it’s possible to say „run the SMS sending command at 7 o’clock“:
echo sms-sending-command | at 07:00
If invoked like that, 07:00 is interpreted to mean „07:00 in the current timezone„. It’s also possible to say that 07:00 is supposed to be in the UTC timezone, like so:
echo sms-sending-command | at 07:00 UTC
On my Solaris 10 machines (and also on my Mac OS X notebook), this really works like it should — but on Linux (I tested ArchLinux, Debian & Mandriva), it doesn’t😦 Check this out:
$ date Do 12. Nov 21:00:53 CET 2009
$ date --utc Do 12. Nov 20:00:57 UTC 2009
$ echo ls | at 20:08 UTC Nov 12 at: refusing to create job destined in the past
$ grep ^HARDWARECLOCK\\\|^TIMEZONE /etc/rc.conf HARDWARECLOCK="UTC" TIMEZONE="Europe/Zurich"
$ echo ls | at 21:08 Nov 12 warning: commands will be executed using /bin/sh job 16 at Thu Nov 12 21:08:00 2009 $ echo ls | at 21:08 UTC Nov 12 warning: commands will be executed using /bin/sh job 17 at Thu Nov 12 21:08:00 2009
It was 21:00 CET on November 12 2009, when I tried this. I wanted at to execute ls at „20:08 UTC Nov 12“ (ie. about 8 minutes after now). This failed, stating that the time was in the past — however, having a look at the clock (as returned by „date“ / „date –utc“), we see that this isn’t true (date showed, that it was 21:00 CET or 20:00 UTC).
To confuse me even further, „at 21:08 Nov 12“ and „at 21:08 UTC Nov 12“ generate jobs which are executed at the same time‽ That’s wrong! job 17 should be run one hour after job 16, because 21:08 UTC == 22:08 CET!
As noted, I tried this on ArchLinux, Mandriva and Debian, all showing the same (for me) unexpected result. Solaris 10 and OS X, on the other hand, act the way I’d expect it to act.
Now, where to turn to, to get this fixed?
Until then, I’d say that this is on Linux a: