Dear friends,
I have a bunch of entries in my crontab, all doing different things at different times. These times are picked up by the computer clock.
However, one particular task (downloading weather maps) would benefit if it was set to download using a clock that does not spring forward and fall back. This is because these maps appear to be released according to GMT/UTC and so setting the time according to the local clock does not quite work. (I am aware that I could set my cron job to be at a specific hour later than the actual during standard time, but I figured that this would be a good opportunity to get to know of such a possibility, if such exists.)
So, how do I make a single entry that uses GMT or UTC, in my crontab? While also using the local time for the other tasks on crontab?
Many thanks and best wishes, Ranjan
On 3/19/23 21:19, Ranjan Maitra wrote:
Dear friends,
I have a bunch of entries in my crontab, all doing different things at different times. These times are picked up by the computer clock.
However, one particular task (downloading weather maps) would benefit if it was set to download using a clock that does not spring forward and fall back. This is because these maps appear to be released according to GMT/UTC and so setting the time according to the local clock does not quite work. (I am aware that I could set my cron job to be at a specific hour later than the actual during standard time, but I figured that this would be a good opportunity to get to know of such a possibility, if such exists.)
So, how do I make a single entry that uses GMT or UTC, in my crontab? While also using the local time for the other tasks on crontab?
That sounds ideal for a systemd timer since it has native support for UTC. You'd need a .service to fetch the weather maps and a .timer to trigger the .service. As far as systemd goes that is pretty basic.
Everything else would stay under cron.
Mike Wright
On 21 Mar 2023, at 08:52, Mike Wright nobody@nospam.hostisimo.com wrote:
On 3/19/23 21:19, Ranjan Maitra wrote:
Dear friends, I have a bunch of entries in my crontab, all doing different things at different times. These times are picked up by the computer clock. However, one particular task (downloading weather maps) would benefit if it was set to download using a clock that does not spring forward and fall back. This is because these maps appear to be released according to GMT/UTC and so setting the time according to the local clock does not quite work. (I am aware that I could set my cron job to be at a specific hour later than the actual during standard time, but I figured that this would be a good opportunity to get to know of such a possibility, if such exists.) So, how do I make a single entry that uses GMT or UTC, in my crontab? While also using the local time for the other tasks on crontab?
That sounds ideal for a systemd timer since it has native support for UTC. You'd need a .service to fetch the weather maps and a .timer to trigger the .service. As far as systemd goes that is pretty basic.
Yep defaults to UTC but allows you to specify the time zone in the OnCalendar property. This is very useful.
Barry
Everything else would stay under cron.
Mike Wright _______________________________________________ users mailing list -- users@lists.fedoraproject.org To unsubscribe send an email to users-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
On Tue Mar21'23 10:47:47PM, Barry wrote:
From: Barry barry@barrys-emacs.org Date: Tue, 21 Mar 2023 22:47:47 +0000 To: Community support for Fedora users users@lists.fedoraproject.org Reply-To: Community support for Fedora users users@lists.fedoraproject.org Subject: Re: OT: is it possible to have one cron job follow GMT/UTC?
On 21 Mar 2023, at 08:52, Mike Wright nobody@nospam.hostisimo.com wrote:
On 3/19/23 21:19, Ranjan Maitra wrote:
Dear friends, I have a bunch of entries in my crontab, all doing different things at different times. These times are picked up by the computer clock. However, one particular task (downloading weather maps) would benefit if it was set to download using a clock that does not spring forward and fall back. This is because these maps appear to be released according to GMT/UTC and so setting the time according to the local clock does not quite work. (I am aware that I could set my cron job to be at a specific hour later than the actual during standard time, but I figured that this would be a good opportunity to get to know of such a possibility, if such exists.) So, how do I make a single entry that uses GMT or UTC, in my crontab? While also using the local time for the other tasks on crontab?
That sounds ideal for a systemd timer since it has native support for UTC. You'd need a .service to fetch the weather maps and a .timer to trigger the .service. As far as systemd goes that is pretty basic.
Thanks, so no cron job? And, my apologies, but where can I get an example?
Yep defaults to UTC but allows you to specify the time zone in the OnCalendar property. This is very useful.
Barry
Everything else would stay under cron.
Mike Wright
Thanks again!
Ranjan
On 22 Mar 2023, at 04:50, Ranjan Maitra mlmaitra@gmx.com wrote:
Thanks, so no cron job? And, my apologies, but where can I get an example?
Here is an example that I use:
$ systemctl --user cat mail-maintenance.timer # /home/barry-mail/.config/systemd/user/mail-maintenance.timer [Unit] Description=mail maintenance
[Timer] OnCalendar=02:45 #OnCalendar=14:45
$ systemctl --user cat mail-maintenance.service # /home/barry-mail/.config/systemd/user/mail-maintenance.service [Unit] Description=mail maintenance
[Service] Type=oneshot # use a shared lock while do the main actions # which include stopping dovecot etc. ExecStart=flock -s /usr/lib/systemd/system/dovecot.service %h/fetchmail/mail-maintenance.sh maintenance
# use a exclusive lock to make sure that there are no other main-maintenance # services running in maintenance mode before turning dovecot back on ExecStartPost=flock -x /usr/lib/systemd/system/dovecot.service %h/fetchmail/mail-maintenance.sh post_dovecot ExecStartPost=%h/fetchmail/mail-maintenance.sh post_fetchmail
The OnCalendar can have a timezone on it like this:
OnCalendar=02:45 UTC
man systemd.time details the format accepted.
Barry