Hi,
I have a requirement that I want to know when router reboots, it should ECHO in LOG that when was last time router rebooted or powered off and how much time it was off by comparing it with current date/time.
Example the script should show in LOGs as following
Router last reboot (Value-A) : xx-date-time
Powered back on (Values-B): xx-date-time
Total downtime difference in hours between values A &B) : ????
I have idea that script can create a variable of last online time and update time in it after very minute, and when router reboots, it should get this value and calculate with current time value and also shows the downtime in hours (or days). I know how can I get value-a and value-B, but how to calculate difference of time in between both values to show in hours and if its in days it should days/hours ?
is it possible ?