Re: Is who -b command available? Need to know when computer was started.
- Date: Tue, 16 Oct 2018 20:21:45 -0600
- From: Brian Inglis <Brian.Inglis@xxxxxxxxxxxxxxxxxx>
- Subject: Re: Is who -b command available? Need to know when computer was started.
On 2018-10-16 10:57, Gary Johnson wrote:
> On 2018-10-16, Peder Sverdrup via cygwin wrote:
>> I am making a script and need to know when the computer was last booted.
>> This can be done with who -b command. I have installed the minimum cygwin
>> and this command is not available.
>> Which package do I need to install in order to have this command available
>> (or any other command that can tell when the computer was last booted).
> The procps-ng package provides the uptime command which will tell
> you how long it has been since the computer was last booted.
/var/run/utmp system startup/shutdown records are not written so who -b shows
nothing although who is included in cygwin Base package coreutils
/proc/uptime shows number of seconds wall time since startup, and number of
seconds idle time since then e.g.:
$ cat /proc/uptime; date -d"now - `cut -d' ' -f1 /proc/uptime` seconds"; uptime
2018 Oct 15 Mon 12:05:18
20:08:34 up 1 day, 8:03, 2 users, load average: 1.81, 1.58, 1.76
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada
This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple