yo8192 / fcron

fcron is an advanced cron for Linux/Unix systems
http://fcron.free.fr
GNU General Public License v2.0
136 stars 12 forks source link

cannot change timezone of root fcrontab #29

Closed covici closed 5 months ago

covici commented 5 months ago

I was trying to use timezone of UTC for the whole crontab, at first I put before each command TZ=UTC but that did not work, so after reading the manual more carefully, I put the following line at the top of the file !timezone(UTC) but none of the jobs were run with UTC timezone, I also tried GMT .

I am using Linux operating system kernel 6.1.82 gentoo distribution.

Am I doing something wrong?

Thanks.

P.S. mailing list subscription returns host unknown.

yo8192 commented 5 months ago

Thanks for pointing out the mailing list issue. Free.fr stopped that service, so they are no longer available. I've updated http://fcron.free.fr/contact.php.

What do you mean they were not run in the UTC timezone? do you mean they were not scheduled in the UTC timezone, or do you mean the TZ env var wasn't set to UTC within the job (if whatever you run checks that) ?

Please provide:

In the meantime, here is what I just tried, keeping in mind I am in timezone BST, so that's UTC+1:

$ fcrontab -l
2024-05-29 17:38:52  INFO listing user's fcrontab
!timezone(UTC)
40 16 * * * echo "16:40 UTC"

$ sudo fcrondyn -x ls
ID   |USER     |SCHEDULE           |CMD
1    |user     |2024-05-29 17:40:00|echo "16:40 UTC"

As you can see, the job was scheduled at 16:40 UTC, which is 17:40 BST, so all works as expected.

covici commented 5 months ago

Thanks for getting back to me. I meant that the timezone variable seemed to have no effect. But, fcron seems not to have been updated in so long that I have moved back to cronie which seems to work fine.

On Wed, 29 May 2024 12:54:14 -0400, Thibault Godouet wrote:

[1 <text/plain; UTF-8 (7bit)>] Thanks for pointing out the mailing list issue. Free.fr stopped that service, so they are no longer available. I've updated http://fcron.free.fr/contact.php.

What do you mean they were not run in the UTC timezone? do you mean they were not scheduled in the UTC timezone, or do you mean the TZ env var wasn't set to UTC within the job (if whatever you run checks that) ?

Please provide:

  • the (optionally redacted) fcrontab file you use, e.g. the output of fcrontab -l (or specify the right user)
  • your timezone, e.g. the output of date and of ls -l /etc/localtime
  • the output of fcrondyn -x ls (optionally redacted)
  • and what version of fcron you use (or whether you use the latest from github).

In the meantime, here is what I just tried, keeping in mind I am in timezone BST, so that's UTC+1:

$ fcrontab -l
2024-05-29 17:38:52  INFO listing user's fcrontab
!timezone(UTC)
40 16 * * * echo "16:40 UTC"

$ sudo fcrondyn -x ls
ID   |USER     |SCHEDULE           |CMD
1    |user     |2024-05-29 17:40:00|echo "16:40 UTC"

As you can see, the job was scheduled at 16:40 UTC, which is 17:40 BST, so all works as expected.

-- Reply to this email directly or view it on GitHub: https://github.com/yo8192/fcron/issues/29#issuecomment-2137865883 You are receiving this because you authored the thread.

Message ID: @.***> [2 <text/html; UTF-8 (7bit)>]

-- Your life is like a penny. You're going to lose it. The question is: How do you spend it?

     John Covici wb2una
     ***@***.***
yo8192 commented 5 months ago

Fair enough, I'll close this one then.