[Dxspider-support] crontab not honouring LOCALE =?utf-8?Q?=3D_?=LOCAL
Keith, G6NHU
g6nhu at me.com
Thu Apr 24 10:56:33 BST 2025
To follow up (before I head off), at 09:49 UTC (10:49 local), I added three lines to test.
51 09 * * * run_cmd("clear/dupefile")
51 10 * * * run_cmd("clear/dupefile")
51 11 * * * run_cmd("clear/dupefile")
In my mind, the one that should have run is the middle one, it’s set run at to 10:51 local.
When crontab ran at 10:51 local time, this is the log entry as shown by watchdbg cron:
09:51:00 (cron) cron: LOCALTIME 51 9 24 4 4 -> doing 'run_cmd("clear/dupefile")'
The first entry is UTC time, ie 09:51:00 but then it shows the entry it actually ran was the 09:51 one (LOCALTIME 51 9) when it should have run the 10:51 entry and shown LOCALTIME 51 10.
Hope this helps.
73 Keith
On 24 Apr 2025 at 08:40 +0100, Keith, G6NHU via Dxspider-support <dxspider-support at tobit.co.uk>, wrote:
> There is definitely something wrong here.
>
> I’m sure that for the first 24 hours of running on the droplet, crontab was executing at the correct time, so for example, these lines in crontab showed files with a timestamp of 22:xx
>
> 30 22 * * * spawn('cd /spider/local_cmd; wget -q https://raw.githubusercontent.com/EA3CV/dxspider_info/main/check_build.pl -O /spider/local_cmd/check_build.pl')
> 31 22 * * * spawn('cd /spider/local_cmd; wget -q https://raw.githubusercontent.com/EA3CV/dxspider_info/main/mnodes.pl -O /spider/local_cmd/mnodes.pl')
> 32 22 * * * spawn('cd /spider/local_cmd; wget -q https://raw.githubusercontent.com/EA3CV/dxspider_info/main/musers.pl -O /spider/local_cmd/musers.pl')
>
> But now they show a timestamp of 23:xx
>
> Similarly, these files show a timestamp of 06:xx
>
> 00 05 * * * run_cmd("download http://www.country-files.com/cty/cty.dat";)
> 02 05 * * * run_cmd("download http://www.country-files.com/cty/wpxloc.raw";)
>
> My badip updates every hour at xx:21, the most recent has just run and here’s how it shows in the log:
>
> 07:21:00 (cron) DXCron::run_cmd: download http://www.dxspider.net/download/badip.torexit
> 07:21:00 (cron) cron: LOCALTIME 21 7 24 4 4 -> doing 'run_cmd("download http://www.dxspider.net/download/badip.torrelay")'
> 07:21:00 (cron) DXCron::run_cmd: download http://www.dxspider.net/download/badip.torrelay
> 07:21:00 (cron) cron: LOCALTIME 21 7 24 4 4 -> doing 'run_cmd("download http://www.dxspider.net/download/badip.global")'
> 07:21:00 (cron) DXCron::run_cmd: download http://www.dxspider.net/download/badip.global
>
> It’s showing LOCALTIME as 21 7 24 4 4, ie Thursday, 4th month, 27th day, 07 hours 21 minutes
>
> When in fact, local time is 08:21.
>
> If I enter ‘date’ in the terminal, it shows this:
>
> Thu Apr 24 08:22:08 BST 2025
>
> I’m away for a couple of days now, heading off to Bletchley Park and the National Radio Centre. Hopefully cracking this one will be easier than breaking Enigma ;-)
>
> 73 Keith.
> On 15 Apr 2025 at 09:06 +0100, Keith, G6NHU via Dxspider-support <dxspider-support at tobit.co.uk>, wrote:
> > I’ve just moved my cluster over to a DO Droplet and this is working correctly on there. As far as I can see, all the timezone stuff is set the same as the Pi I was using and I just cloned my spider folder over.
> >
> > 73 Keith.
> > On 14 Apr 2025 at 12:13 +0100, Dirk Koopman via Dxspider-support <dxspider-support at tobit.co.uk>, wrote:
> > > This is what the code does. As you can see, if the locale is local (use_localtime is true) then the values in the hour (in particular) is compared with the outcome of using localtime(), rather than gmtime(). At the moment of comparison, the code does not know (nor care) what timezone it is in. It just compares two values. So I remain confused.
> > >
> > > Could you do a 'set/debug cron', then either run a 'watchdbg cron' in an window or, as it will be watch paint drying "event", do a 'grepdbg cron' after a fault has occurred - use 'grepdbg 1 cron' if it was yesterday. NOTE: 'set/debug cron' must have been set *before* any fault in order for grepdbg to pick it up. Then send me a representative sample of data that you collect (directly rather than via the list).
> > >
> > > Dirk
> > >
> > > # process the cronjobs
> > > sub process
> > > {
> > > my $now = $main::systime;
> > > return if $now-$lasttime < 1;
> > >
> > > my ($sec, $min, $hour, $mday, $mon, $wday);
> > > if ($use_localtime) {
> > > ($sec, $min, $hour, $mday, $mon, $wday) = (localtime($now))[0,1,2,3,4,6];
> > > } else {
> > > ($sec, $min, $hour, $mday, $mon, $wday) = (gmtime($now))[0,1,2,3,4,6];
> > > }
> > >
> > > # are we at a minute boundary?
> > > if ($min != $lastmin) {
> > >
> > > # read in any changes if the modification time has changed
> > > init();
> > >
> > > $mon += 1; # months otherwise go 0-11
> > > my $cron;
> > > foreach $cron (@crontab) {
> > > if ((!$cron->{min} || grep $_ eq $min, @{$cron->{min}}) &&
> > > (!$cron->{hour} || grep $_ eq $hour, @{$cron->{hour}}) &&
> > > (!$cron->{mday} || grep $_ eq $mday, @{$cron->{mday}}) &&
> > > (!$cron->{mon} || grep $_ eq $mon, @{$cron->{mon}}) &&
> > > (!$cron->{wday} || grep $_ eq $wday, @{$cron->{wday}}) ){
> > >
> > > if ($cron->{cmd}) {
> > > my $s = $use_localtime ? "LOCALTIME" : "UTC";
> > > dbg("cron: $s $min $hour $mday $mon $wday -> doing '$cron->{cmd}'") if isdbg('cron');
> > > eval $cron->{cmd};
> > > dbg("cron: cmd error $@") if $@ && isdbg('cron');
> > > }
> > > }
> > > }
> > > }
> > >
> > > # remember when we are now
> > > $lasttime = $now;
> > > $lastmin = $min;
> > > }
> > >
> > > On 12/04/2025 21:28, Keith, G6NHU via Dxspider-support wrote:
> > > > Local time: Sat 2025-04-12 21:28:17 BST
> > > > Universal time: Sat 2025-04-12 20:28:17 UTC
> > > > RTC time: Sat 2025-04-12 20:28:17
> > > > Time zone: Europe/London (BST, +0100)
> > > > System clock synchronized: yes
> > > > NTP service: active
> > > > RTC in local TZ: no
> > > >
> > > >
> > > >
> > > > On 12 Apr 2025 at 21:26 +0100, Dirk Koopman via Dxspider-support <dxspider-support at tobit.co.uk>, wrote:
> > > > > Please run timedatectl in a shell on your machine.
> > > > >
> > > > > Dirk
> > > > >
> > > > > > On 12 Apr 2025, at 20:33, Keith, G6NHU via Dxspider-support <dxspider-support at tobit.co.uk> wrote:
> > > > > >
> > > > > >
> > > > > >
> > > > > > sh/var $DXCron::use_localtime
> > > > > > $DXCron::use_localtime = 1
> > > > > > On 12 Apr 2025 at 16:40 +0100, Christopher Schlegel via Dxspider-support <dxspider-support at tobit.co.uk>, wrote:
> > > > > > > Not sure I can help, but seeing what we can see.
> > > > > > > What is the output if you do a:
> > > > > > > sh/var $DXCron::use_localtime
> > > > > > > In the sysop console.
> > > > > > > Chris WI3W
> > > > > > >
> > > > > > > On Sat, Apr 12, 2025, 11:04 Keith, G6NHU via Dxspider-support <dxspider-support at tobit.co.uk> wrote:
> > > > > > > > Yes, it’s been in my crontab since the day it was announced in January 2023!
> > > > > > > >
> > > > > > > > I’m pretty sure it has worked correctly before, it’s just that I noticed it a couple of days ago because of the node reboot time.
> > > > > > > >
> > > > > > > > 73 Keith.
> > > > > > > > On 12 Apr 2025 at 15:23 +0100, Christopher Schlegel via Dxspider-support <dxspider-support at tobit.co.uk>, wrote:
> > > > > > > > > Keith,
> > > > > > > > > Has DXSpider been restarted since that change? Again just tossing possibilities as there are some variables that will only update on startup.
> > > > > > > > > Chris WI3W
> > > > > > > > >
> > > > > > > > > > On Sat, Apr 12, 2025, 04:32 Keith, G6NHU <g6nhu at me.com> wrote:
> > > > > > > > > > > It always shows local time. So if I do a date command, it shows me this:
> > > > > > > > > > >
> > > > > > > > > > > Fri 11 Apr 21:09:36 BST 2025
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > On 11 Apr 2025 at 20:52 +0100, Keith, G6NHU <g6nhu at me.com>, wrote:
> > > > > > > > > > > >
> > > > > > > > > > > > It always shows local time. So if I do a date command, it shows me this:
> > > > > > > > > > > >
> > > > > > > > > > > > Fri 11 Apr 21:09:36 BST 2025
> > > > > > > > > _______________________________________________
> > > > > > > > > Dxspider-support mailing list
> > > > > > > > > Dxspider-support at tobit.co.uk
> > > > > > > > > https://mailman.tobit.co.uk/mailman/listinfo/dxspider-support
> > > > > > > > _______________________________________________
> > > > > > > > Dxspider-support mailing list
> > > > > > > > Dxspider-support at tobit.co.uk
> > > > > > > > https://mailman.tobit.co.uk/mailman/listinfo/dxspider-support
> > > > > > > _______________________________________________
> > > > > > > Dxspider-support mailing list
> > > > > > > Dxspider-support at tobit.co.uk
> > > > > > > https://mailman.tobit.co.uk/mailman/listinfo/dxspider-support
> > > > > > _______________________________________________
> > > > > > Dxspider-support mailing list
> > > > > > Dxspider-support at tobit.co.uk
> > > > > > https://mailman.tobit.co.uk/mailman/listinfo/dxspider-support
> > > > > _______________________________________________
> > > > > Dxspider-support mailing list
> > > > > Dxspider-support at tobit.co.uk
> > > > > https://mailman.tobit.co.uk/mailman/listinfo/dxspider-support
> > > >
> > > > _______________________________________________
> > > > Dxspider-support mailing list
> > > > Dxspider-support at tobit.co.uk
> > > > https://mailman.tobit.co.uk/mailman/listinfo/dxspider-support
> > >
> > > _______________________________________________
> > > Dxspider-support mailing list
> > > Dxspider-support at tobit.co.uk
> > > https://mailman.tobit.co.uk/mailman/listinfo/dxspider-support
> > _______________________________________________
> > Dxspider-support mailing list
> > Dxspider-support at tobit.co.uk
> > https://mailman.tobit.co.uk/mailman/listinfo/dxspider-support
> _______________________________________________
> Dxspider-support mailing list
> Dxspider-support at tobit.co.uk
> https://mailman.tobit.co.uk/mailman/listinfo/dxspider-support
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.tobit.co.uk/pipermail/dxspider-support/attachments/20250424/1f6d0c22/attachment-0001.htm>
More information about the Dxspider-support
mailing list