A very #MySoCalledSudoLife day.โ€‹ This morning I:

  • Created my first cron job (I will look into systemd timers this weekend, just in case)

  • I bought a Heltec v3 kit - so I can try off-grid mesh communication when I'm at my parents' in Italy later this month

  • Thanks for all your help and advice with cron jobs! I really appreciate ๐Ÿ™

    I just learned a couple of minutes ago that "CRON jobs in general run in UTC time" - so 9pm for my cron job means 11pm Paris time โ€‹

    I guess I'll find out tomorrow morning if it worked (I'm too tired now to tweak it) ๐Ÿฅฒ

    Good night Fedi friends!

    @elena

    In most cases, cron follows the system's time zone.

    More info here:
    https://cronjob.live/docs/cron-timezones by recurohq
    https://crontab.io/timezone-converter by johnsorrentino

    CRON_TZ https://www.man7.org/linux/man-pages/man5/crontab.5.html

    #cron #unix #timezone

    Cron Timezones - Complete Guide to Timezone Handling | Cronjob.live

    Master cron timezone handling, DST issues, and best practices. Learn how to handle timezone complexity in cron job scheduling.

    Cronjob.live
    @gvlx thank you! Itโ€™s installed on a VPS hosted in Lithuaniaโ€ฆ it hasnโ€™t run yet so Iโ€™m guessing that it either doesnโ€™t work (my code) or itโ€™s on UTC time. I guess Iโ€™ll find out tomorrow morning ๐Ÿ˜…
    @elena Check the docs, you can force the timezone per line
    @gvlx it worked at 11pm CET (9pm UTC time). So I just tweaked the code, subtracting 2 hours. Very exciting. The next scheduled run will be at 9am my time on Monday...

    @elena it should depend and run depending on /etc/locatime. So if the Cloud is above UTC+4 and you want to run stuff related to UTC-2, youโ€™ll have to do the Maths ๐Ÿ˜†

    In some case, it may be possible to set some sort of TZ variables. But man page is required there.

    @joel it was UTC time indeed... I just checked this morning and the cron job worked... but at 11pm (instead of 9pm). I just tweaked the file subtracting 2 hours ๐Ÿ˜…โ€‹
    @elena @joel It is important to read โ€˜man 5 crontabโ€™. Linux distros often use different implementations of cron with extra functionality to the original Vixie cron. Mac and BSD are closer to the simpler original from the 1980s. The nice part about unix like systems is that you have choice and you can install the cron you want e.g. anacron for systems that are not always on (laptops) so your cron jobs will run when the system is switched on.
    @grumpyoldtechie thank you for the helpful insights ๐Ÿ™

    @elena cron will respect the system time zone, but its common for servers to be set up in UTC time at bigger companies so all the timestamps in logs are consistent across all servers in all timezones, otherwise its difficult to compare logs across regions.

    Good luck and welcome to the club :-)

    @raven667 thank you! I just checked this morning and it worked... cron jobs feel like magic. sooo cool!

    @elena what @raven667 said, and a small note that if it's important to you that a cron job on a UTC configured system runs at a particular CET/CEST time, you might have to alter the crontab definition at the next DST change.

    Of course you could set up a cron job to notify you ... ๐Ÿ™‚

    @jpmens
    systemd timers can do jobs at any timezone. If that is important consider to use a timer and not crontab.
    @elena @raven667
    @elena
    It makes a difference for daylight saving. It's easier to change the clock only for display time, and leave the true time alone, than to clean up yet again, after having forgotten why you should never run cron jobs between 1a.m. an 3a.m.