What's new

Best log message to detect boot/reboot

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

wan0_bound.env comes from dhcpc IIRC.

I don't have /tmp/WAN0_state on my router.

Still on the right track then, I stumbled on that haphazardly somehow

wanup_date="$(cat $infile | awk '/Initial clock set|WAN was restored/ {a=$0} END{print substr (a,1,15)}')"
wanup_secs="$(/bin/date --date="$wanup_date" -D '%b %e %T' +'%s')"
Thanks, I run the strings through a loop for terminal messages and falling back through the 4 search methods, but I got to learn about substr, I may have a use for it if I can experiment with it more

Hows your luck using date to convert a date/time to another TZ? In all my tests it seems this busybox date doesnt support it
 
Hows your luck using date to convert a date/time to another TZ? In all my tests it seems this busybox date doesnt support it
That's not something I've ever thought about, because I've never needed to do it. I can't think of a situation where I would want to process timestamps on the router that weren't in my locale. That's more the kind of thing that databases and remote log servers would do when collecting data from different geographical regions. That seems beyond the scope of this thread.

EDIT: I've just tested this and it seems to work fine with different time zones. It even compensates for DST. But you do have to set $TZ so that it matches what was set on the source when the timestamp string was created.
 
Last edited:
I've just tested this and it seems to work fine with different time zones. It even compensates for DST. But you do have to set $TZ so that it matches what was set on the source when the timestamp string was created.
I had 9 lines to convert router default date/time to router TZ ha

Ive abandoned the default date/time check though, you're right and just validating its appearance vs last NTP sync (or no found NTP sync) as the script will only run after NTP has been synced and WAN up
 

Similar threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top