TIP: Click on subject to list as thread! ANSI
echo: rberrypi
to: ALL
from: A. DUMAS
date: 2018-12-07 21:00:00
subject: Re: Odd date behaviour

Op 07-12-18 om 15:43 schreef Adrian:
> I've got a cron job that runs every minute, calling a bash script.  The
> script writes out to a log file every time it runs giving the state of a
> sensor, typically four or five lines of output, and each stage starts
> with the time, generated by :
>
> date +%H%M
>
> If there is a change in the state of the sensor, then this will be
> reported, using just the date command :
>
> echo `date` 
>
> The strange thing is that the entries published every minute are
> accurate, but in the change of state entries can be out by anything up
> to 9 minutes late, the discrepancy varies.

Is it possible that two different date programs are called? Maybe one is
the program and the other a script or an alias? (although aliases don't
work from a script). Are both run from a sudo context? One might be in a
different $PATH. Try being very specific:

/bin/date '+%T'
echo "$(/bin/date '+%F %T %z') message"

--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)

SOURCE: echomail via QWK@docsplace.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.