Scripts to keep Date and logs between reboots

Post new topic   Reply to topic    DD-WRT Forum Index -> Contributions Upload
Author Message
ciscodlink
DD-WRT User


Joined: 13 May 2014
Posts: 273

PostPosted: Sat Jan 30, 2021 15:42    Post subject: Scripts to keep Date and logs between reboots Reply with quote
Thought I'd share a couple of script commands that I use to carry over the date and logs between reboots, they require the permenat storage such as jffs. I carry over the date in the rare case ntp doesn't work.

Startup Script

Code:
date +%s -s @$(awk '(getline a <"/proc/uptime") <= 0 {exit}; {printf ($0 + ("%f"a/1000))}' /jffs/date.old

cat /jffs/messages /tmp/var/log/messages > /tmp/var/log/messages.0 && tail -c 5000 /tmp/var/log/messages.0 > /tmp/var/log/messages && rm /tmp/var/log/messages.0



Shutdown Script

Code:
date +%s > /jffs/date.old

tail -c 5000 /var/log/messages > /jffs/messages
Sponsor
mwchang
DD-WRT Guru


Joined: 26 Mar 2013
Posts: 1851
Location: Hung Hom, Hong Kong

PostPosted: Mon Nov 07, 2022 7:25    Post subject: Reply with quote
Might be related:

DD-WRT :: View topic - System Log on USB
https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=331542

_________________
Router: Asus RT-N18U (rev. A1)

Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!

Facebook: https://www.facebook.com/changmanwai
Website: https://sites.google.com/site/changmw
SETI@Home profile: http://setiathome.berkeley.edu/view_profile.php?userid=211832
GitHub: https://github.com/changmw/changmw
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Contributions Upload All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum