Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #229225
| From | Dan Ritter <dsr@randomstring.org> |
|---|---|
| Newsgroups | linux.debian.user |
| Subject | Re: Cron Jobs and Time Zones Has Anything Changed? |
| Date | 2020-12-02 19:20 +0100 |
| Message-ID | <BhETn-63f-1@gated-at.bofh.it> (permalink) |
| References | <BhAwp-2TQ-3@gated-at.bofh.it> <BhAwp-2TQ-1@gated-at.bofh.it> <BhAPL-30y-1@gated-at.bofh.it> <BhAZs-3j7-7@gated-at.bofh.it> <BhE70-5pZ-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Martin McCormick wrote:
> Greg Wooledge <wooledg@eeg.ccf.org> writes:
> > I was vaguely thinking of a similar approach. Set up a job that runs
> > every hour, or across a set of hours that will cover all the possible
> > cases that you care about, in your crontab. Within the job itself,
> > set a TZ variable and determine the time in that time zone by whatever
> > means necessary, and then either abort or continue based on that time.
This approach:
- does not replace crond, and so does not screw up upgrades to
the next version of Debian
- is a small, useful utility which could be adopted rapidly and
later packaged for Debian
- can be ignored by people who don't need it.
> Crontab would have a new field at the beginning of each
> line which could normally be left at "default" which would be the
> normal behavior that we are used to.
This approach requires one of:
- convince the upstream maintainer of cron to adopt it
- convince the Debian maintainer of cron to adopt it as a patch
that gets applied and potentially broken/fixed on each release
- creates a new cron package in competition with the existing
one
- creates a local cron package that has to be maintained along
with upstream changes
The third approach would be to build cronie for Debian, which is
probably do-able but is nevertheless a competitor for cron and
faces similar issues.
> I haven't looked at the C code for cron, but I have
> written a few perl scripts that do things with time and dates and
> the current epoch-based number of seconds since utc Midnight January
> 1, 1970 is based on the C modules such that one's current
> wall-clock time is time(localtime). Just a thought
Perl is definitely an appropriate language for a utility
like this.
libdatetime-timezone-perl
libtime-parsedate-perl
libdatetimex-easy-perl
are all extremely common installs.
As a name for the utility, I suggest "do-if-time-in" and require
three parameters:
do-if-time-in timezone time "command"
As an interim fix, though: (and I know Greg's going to fix this)
---
#!/bin/bash
TZ=$1
NOW=$(date +%H%M)
echo $NOW
if [ "$2" = "$NOW" ] ;
then echo $("$3")
fi
---
-dsr-
Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Cron Jobs and Time Zones Has Anything Changed? "Martin McCormick" <martin.m@suddenlink.net> - 2020-12-02 14:40 +0100
Re: Cron Jobs and Time Zones Has Anything Changed? Greg Wooledge <wooledg@eeg.ccf.org> - 2020-12-02 14:40 +0100
Re: Cron Jobs and Time Zones Has Anything Changed? Dan Ritter <dsr@randomstring.org> - 2020-12-02 15:00 +0100
Re: Cron Jobs and Time Zones Has Anything Changed? "James B" <portoteacher80@fastmail.com> - 2020-12-02 15:00 +0100
Re: Cron Jobs and Time Zones Has Anything Changed? Andy Smith <andy@strugglers.net> - 2020-12-02 17:30 +0100
Re: Cron Jobs and Time Zones Has Anything Changed? "James B" <portoteacher80@fastmail.com> - 2020-12-02 17:30 +0100
Re: Cron Jobs and Time Zones Has Anything Changed? "Martin McCormick" <martin.m@suddenlink.net> - 2020-12-03 14:40 +0100
Re: Cron Jobs and Time Zones Has Anything Changed? Andy Smith <andy@strugglers.net> - 2020-12-04 03:20 +0100
Re: Cron Jobs and Time Zones Has Anything Changed? Andy Smith <andy@strugglers.net> - 2020-12-04 03:40 +0100
Re: Cron Jobs and Time Zones Has Anything Changed? David <bouncingcats@gmail.com> - 2020-12-04 03:40 +0100
Re: Cron Jobs and Time Zones Has Anything Changed? Andrei POPESCU <andreimpopescu@gmail.com> - 2020-12-04 11:20 +0100
Re: Cron Jobs and Time Zones Has Anything Changed? "Martin McCormick" <martin.m@suddenlink.net> - 2020-12-06 19:30 +0100
Re: Cron Jobs and Time Zones Has Anything Changed? Andrei POPESCU <andreimpopescu@gmail.com> - 2020-12-07 09:10 +0100
Re: Cron Jobs and Time Zones Has Anything Changed? Greg Wooledge <wooledg@eeg.ccf.org> - 2020-12-02 15:10 +0100
Re: Cron Jobs and Time Zones Has Anything Changed? "Martin McCormick" <martin.m@suddenlink.net> - 2020-12-02 18:30 +0100
Re: Cron Jobs and Time Zones Has Anything Changed? Dan Ritter <dsr@randomstring.org> - 2020-12-02 19:20 +0100
Re: Cron Jobs and Time Zones Has Anything Changed? Greg Wooledge <wooledg@eeg.ccf.org> - 2020-12-02 19:40 +0100
Re: Cron Jobs and Time Zones Has Anything Changed? Eduardo M KALINOWSKI <eduardo@kalinowski.com.br> - 2020-12-02 15:10 +0100
Re: Cron Jobs and Time Zones Has Anything Changed? Fabrice BAUZAC-STEHLY <noon@mykolab.com> - 2020-12-03 16:10 +0100
csiph-web