Cron Timezone does not match system timezone

Where is the timezone setting for the cron jobs? I have setup this job:

task-scheduler {
task backups {
crontab-spec "30 0 * * *"
executable {
path /config/scripts/

Set to run at 00:30 (aka 12:30AM). I am in Mountain timezone. My system is set to mountain timezone:

~$ date
Wed 04 Jan 2023 09:54:46 PM MST

But, the cron job runs at 5:30PM MST every day. That is the time difference between me and UTC.

Is it possible you are logged in as a user that has the timezone set to MST? If that is the case, it is possible that the system time zone is still set as the default of UTC? What’s the output of timedatectl?

As a workaround, you can add this line “EXPORT TZ=Region/City” in your script which will make it run on your local time or you can configure the “interval” option to execute.


#! /bin/bash

EXPORT TZ=Europe/London


vyos@server# set system task-scheduler task test1 interval
Possible completions:
Execution interval in minutes
m Execution interval in minutes
h Execution interval in hours
d Execution interval in days

Thanks. It fixed itself with some update along the way. I run my own builds from current repo, not the stable 1.3.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.