[Dxspider-support] crontab not honouring LOCALE = LOCAL
Dirk Koopman
djk at tobit.co.uk
Mon Apr 14 12:13:13 BST 2025
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.tobit.co.uk/pipermail/dxspider-support/attachments/20250414/808080f7/attachment.htm>
More information about the Dxspider-support
mailing list