LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 10-25-2020, 04:10 PM   #1
prinsepia
LQ Newbie
 
Registered: Aug 2020
Distribution: Raspberry Pi OS
Posts: 3

Rep: Reputation: Disabled
Cron job not working as expected, Raspberry Pi OS, Raspberry Pi 4B


Hi all!

This is the cron job I am using right now for a daily program:

# ...
# m h dom mon dow command
1 0 * * 1-7 cd /home/pi/prg && python3 /home/pi/prg/spread.py > outfile 2>&1

I wanted the job to start at 00:01 am, but it always starts at 01:01 am.

My time zone:
Central European Standard Time (CET) (GMT+1)

When I check the time zone of the Raspberry Pi OS using the 'date' command, I see the OS is also configured as GMT+1.

Does someone know how to fix this or what I could do to make my program start at 00:01 am? Did someone run into the same or a similar issue?

Thank you guys in advance!~

Cheers,
Prinsepia
 
Old 10-26-2020, 03:51 AM   #2
lvm_
Member
 
Registered: Jul 2020
Posts: 48

Rep: Reputation: Disabled
Time zone is user-specific, cron however schedules tasks based on the default server time zone specified in /etc/localtime or UTC if /etc/localtime is invalid. Run 'sudo ln -sf /usr/share/zoneinfo/CET /etc/localtime' to fix (assuming tzdata is installed).
 
Old 10-26-2020, 04:07 AM   #3
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 5,235
Blog Entries: 3

Rep: Reputation: 2586Reputation: 2586Reputation: 2586Reputation: 2586Reputation: 2586Reputation: 2586Reputation: 2586Reputation: 2586Reputation: 2586Reputation: 2586Reputation: 2586
There is a Raspberry Pi OS - specific configuration utility which will set the time zone for the account.

Code:
sudo raspi-config
Then choose "4 Localisation Options" -> "I2 Change Time Zone" -> "Europe" and then the relevant city.

The raspi-config utility can be used in a script or else you can try making the symbolic link as shown in the previous post.
 
  


Reply

Tags
cronjob, crontab, time


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
I have scheduled cron job but it not running as expected. Sujith Sagar CentOS 8 05-22-2016 09:16 AM
Cron Job Not Running - Looks Like Cron Tried Noble User Linux - Newbie 7 10-26-2014 11:26 AM
how to abort cron if the previous cron job not yet finished? Winanjaya Linux - Newbie 2 05-22-2012 07:44 PM
adding a perl script to cron.daily / cron.d to setup a cron job CrontabNewBIE Linux - Software 6 01-14-2008 09:16 AM
cron not working from crontab nor form /etc/cron/cron.d. What did SuSE change? JZL240I-U SUSE / openSUSE 11 01-04-2007 02:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 03:26 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration