What's new
  • 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!

Saving traffic history stats before a reboot

Jeffrey Young

Very Senior Member
Hello all,

So I have been googling and searching these forums for the past hour or so without finding what I am looking for. Hopefully someone can help me here.

I want to set up a custom cron job to reboot my router. That part is no problem (setting up a once a month reboot), I got that part down and working.

I want to have the router save the traffic history stats to the USB key first before rebooting. I have the rstat file being saved once an hour now to the USB drive. But I have need to stay as accurate as possible, so I would like to force a save, via a script, before calling the reboot command.

Any help here would be appreciated.

Thanks
 
Why do you want to reboot? Unless there is something wrong you should be able to stay up for a very long time without issues. I customarily go as long as it is between Merlin releases without rebooting.
 
Why do you want to reboot? Unless there is something wrong you should be able to stay up for a very long time without issues. I customarily go as long as it is between Merlin releases without rebooting.


Preventative measure mostly. I work away from home with the rest of the family working at home (wife's business and kid's school). Hopefully save me a frantic technical call someday :)

Secondarily, would like to know if the above is possible simply from a learning perceptive.
 
I want to have the router save the traffic history stats to the USB key first before rebooting. I have the rstat file being saved once an hour now to the USB drive. But I have need to stay as accurate as possible, so I would like to force a save, via a script, before calling the reboot command.

I remember traffic data file being saved automatically every 00MIN of the hour (check the time stamp), so if you set a router reboot at 4.02AM (for example) the saved data file will be quite accurate. This might be a simple solution to what you need.
 
rstats updates it's files at the specified hourly interval as offset from the router's boot time (uptime), not on the hour. Looking at the source code we can see that rstats will update uncommitted data after receiving a SIGTERM (and then terminate itself). So I suggest this command:
Code:
killall -SIGTERM rstats
 
Be aware that the 86U not infrequently shuts off when rebooted and requires a power cycle. I rebooted about 10 times in the last two days, and mine shut down twice. I ain't never rebooting if I don't have to.
 
rstats updates it's files at the specified hourly interval as offset from the router's boot time (uptime), not on the hour. Looking at the source code we can see that rstats will update uncommitted data after receiving a SIGTERM (and then terminate itself). So I suggest this command:
Code:
killall -SIGTERM rstats

Thanks @ColinTaylor . Never even dawned to check the source code .... dhhhh

Be aware that the 86U not infrequently shuts off when rebooted and requires a power cycle. I rebooted about 10 times in the last two days, and mine shut down twice. I ain't never rebooting if I don't have to.

Thanks @elorimer for that info. Kind of wish I knew that before I bought the router at the end of January. My AC68U passed away on me (the wan port stopped working, everything else was fine).

Thanks @Val D. for the link.
 
I've moved to the 86U from an 87U, and it is a nice improvement--way faster at doing all the foolin around we do here. But this is a problem I hope gets hunted down.
 

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!
Back
Top