[asterisk-users] uptime

Tilghman Lesher tilghman at meg.abyt.es
Tue Feb 15 13:12:19 CST 2011


On Tuesday 15 February 2011 12:13:37 Jeff LaCoursiere wrote:
> On Tue, 15 Feb 2011, A J Stiles wrote:
> > On Tuesday 15 Feb 2011, Jeff LaCoursiere wrote:
> >> Now this is what I call uptime...
> >> 
> >> minipbx*CLI> show uptime
> >> System uptime: 41 years, 7 weeks, 6 days, 3 hours, 26 minutes, 46
> >> seconds Last reload: 8 hours, 3 minutes, 51 seconds
> >> 
> >> Bizarre bug?
> > 
> > I'm guessting, this is a brand new machine on its first ever boot,
> > with no "last bootup time" information saved anywhere.  So it assumes
> > the last bootup date was 1970-01-01 00:00:00, i.e. "zero time" on all
> > Unix-like systems.  That would explain the 41 years, anyway.
> 
> No, it is a few months old now with lots of reboots.  It is my
> experiment to build a reliable PBX out of Seagate Dockstar hardware and
> USB sticks. I've now blown up about three 4G sticks, presumably for
> heat issues (?), and have just bought an "SLC" based stick (which was
> not easy to find) that supposedly has a better heat range and longer
> write life.
> 
> Once I got it working I saved a dd image of the stick and have just been
> imaging the new sticks as I try them.  This *is* the first boot on this
> new stick, but the filesystem itself is "old", with several reboots.
> 
> I don't really care about the uptime calculation, just thought it was
> funny. It is strange that asterisk and the OS don't agree... so how
> does asterisk compute it?

The system has a monotonically incrementing integer (jiffies), which is used
for uptime calculations.  Asterisk just stores the time the process
started, then performs a simple subtraction from the current time.  If your
system clock doesn't have large jumps while Asterisk is running, it's a
good calculation.  BTW, the Linux uptime counter also has an inherent
problem:  at some point, the counter will overflow and uptime will return to
0.  On older Linux systems, this occurred at 497 days.

-- 
Tilghman



More information about the asterisk-users mailing list