Scripts to keep Date and logs between reboots

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


Joined: 13 May 2014
Posts: 254

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
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum 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