From a server hosted in Poland (UTC +01:00), is there a way I can consistently have a crontab entry run at 9am New York time (UTC -05:00)?For me this wasn't trivial since the daylight saving time ended last Sunday in Poland, so jobs that I have scheduled to run at 15:00 their local time most of the year are late this week by an hour from the point of view of US stock exchanges.I remember Congress' decision a few years ago to extend DST, which put things out of sync for a few weeks per year.One workaround I am not even sure would work (which I prefer to avoid anyhow) is that when I have a task:0 14 * * * somethingI fetch NY's time TZ=:US/Eastern date +%s and compare using bash arithmetic whether I should sleep 3600 or not before running something
crontab and DST disagreement with different timezone
cron;timezone
Okay, since altering the TZ env for date does seem to call up the correct current time in Ubuntu, this is at least a workaround (the one I was trying not to rely on):SHELL=/bin/bash0 14 * * 1-5  [ $[10#$(date +\%H) - 10#$(TZ=:US/Eastern date +\%H)] == 5 ] || sleep 3600; w;dfSo this aims to run w;df at 9am ET Mon-Fri. Instead of hour 15 I put in 14 with the possibility of sleeping one hour (3600 seconds) before running further commands.