my-server
← Wiki

Uptime

Uptime is a measure of system reliability, expressed as the period of time a machine, typically a computer, has been continuously working and available. Uptime is the opposite of downtime.

It is often used as a measure of computer operating system reliability or stability, in that this time represents the time a computer can be left unattended without crashing or needing to be rebooted for administrative or maintenance purposes. Conversely, long uptime may indicate negligence, because some critical updates can require reboots on some platforms.

Records

In 2005, Novell reported a server with a 6-year uptime. This level of uptime is common when servers are maintained under an industrial context and host critical applications such as banking systems.

Netcraft maintains the uptime records for many thousands of web hosting computers.

A server running Novell NetWare has been reported to have been shut down after 16 years of uptime due to a failing hard disk.

Determining system uptime

Unix-like systems (Linux, FreeBSD)

<span id="coreutils"></span> Using uptime

Most Unix-like systems including Linux, FreeBSD, Mac OS X, and SySVr4 have the uptime command. It also displays the system load averages for the past 1, 5, and 15-minute intervals:

This command originated in 3.0BSD and has become ubiquitous among Unix systems ever since. Despite almost always providing the same collection of information and being so ubiquitous, it is not part of any Unix-related standard, neither SUS nor POSIX.

On Linux, an uptime command is part of GNU coreutils, BusyBox and Toybox.

On BSD, the uptime command is hard link to the w program. The w program is based on the RSTS/E, TOPS-10, and TOPS-20 SYSTAT program.

Using system-specific interfaces

Each Unix-like system also has its own private interfaces for obtaining the system uptime.

Linux

On Linux, several procfs files provide information on the system uptime. The main file is , but provides related information too.

The first number is the total number of seconds the system has been up. The second number is how much of that time the machine has spent idle, in seconds. On multi-core systems (and some Linux versions) the second number is the sum of the idle time accumulated by each CPU.

The C API for uptime information is .

BSD

On BSD systems and macOS (a combination of BSD and XNU parts), the uptime information is available from the sysctl system, both in the form of the sysctl command and the C function. The sysctl entry is called , which provides boot time that can be converted to an uptime by subtracting it from the current time:

macOS also provides the uptime as , a POSIX interface with implementation-defined starting point; macOS sets the starting point at system boot. and are additional ways to access the same raw monotonic clock.

On FreeBSD (but not macOS), the kernel exports three symbols that can be used as variables in C to obtain the boot time and uptime. They are called , , and . These require no function call at all to use, unlike . Higher-precision uptime is provided from functions such as .

Microsoft Windows

Windows Task Manager

Some versions of Microsoft Windows include an uptime field in Windows Task Manager, under the "Performance" tab. The format is D:HH:MM:SS (days, hours, minutes, seconds).

systeminfo

The output of the <code>systeminfo</code> command includes a "System Up Time" or "System Boot Time" field.

The exact text and format are dependent on the language and locale. The time given by <code>systeminfo</code> is not reliable. It does not take into account time spent in sleep or hibernation. Thus, the boot time will drift forward every time the computer sleeps or hibernates.

NET command

The <code>NET</code> command with its <code>STATISTICS</code> sub-command provides the date and time the computer started, for both the <code>NET STATISTICS WORKSTATION</code> and <code>NET STATISTICS SERVER</code> variants. The command <code>NET STATS SRV</code> is shorthand for <code>NET STATISTICS SERVER</code>. The exact text and date format is dependent on the configured language and locale.

Windows Management Instrumentation (WMI)

Uptime can be determined via Windows Management Instrumentation (WMI), by querying the <code>LastBootUpTime</code> property of the <code>Win32_OperatingSystem</code> class. At the command prompt, this can be done using the <code>wmic</code> command:

The timestamp uses the format <code>yyyymmddhhmmss.nnn</code>, so in the above example, the computer last booted up on 8 May 2011 at 16:17:51.822. The text "LastBootUpTime" and the timestamp format do not vary with language or locale. WMI can also be queried using a variety of application programming interfaces, including VBScript or PowerShell.

Uptime.exe

Microsoft formerly provided a downloadable utility called <code>Uptime.exe</code>, which reports elapsed time in days, hours, minutes, and seconds.

The time given by <code>Uptime.exe</code> is not reliable. It does not take into account time spent in sleep or hibernation. Thus, the boot time will drift forward every time the computer sleeps or hibernates.

FreeDOS

The <code>uptime</code> command is also available for FreeDOS. The version was developed by M. Aitchison.

OpenVMS

On OpenVMS systems, the <code>show system</code> command can be used at the DCL command prompt to obtain the system uptime. The first line of the resulting display includes the system's uptime, displayed as days followed by hours:minutes:seconds. In the following example, the command qualifier <code>/noprocess</code> suppresses the display of per-process detail lines of information.

The command output above shows that node JACK on 29 January 2008 at 16:32:04.67 has an uptime of 894 days 22 hours 28 minutes and 52 seconds.

See also

References