public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Is who -b command available? Need to know when computer was started.
@ 2018-10-16 15:36 Peder Sverdrup via cygwin
  2018-10-16 16:03 ` john doe
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Peder Sverdrup via cygwin @ 2018-10-16 15:36 UTC (permalink / raw)
  To: cygwin

Hi,

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).

 

Kind regards, Peder

 


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Is who -b command available? Need to know when computer was started.
  2018-10-16 15:36 Is who -b command available? Need to know when computer was started Peder Sverdrup via cygwin
@ 2018-10-16 16:03 ` john doe
  2018-10-16 16:57 ` Gary Johnson
  2018-10-16 18:54 ` cyg Simple
  2 siblings, 0 replies; 6+ messages in thread
From: john doe @ 2018-10-16 16:03 UTC (permalink / raw)
  To: cygwin

On 10/16/2018 5:36 PM, Peder Sverdrup via cygwin wrote:
> Hi,
> 
> 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).
> 

If you have 'SystemInfo' you could try:

$ cmd.exe /C "SystemInfo /FO list" | grep 'System Boot Time'

-- 
John Doe

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Is who -b command available? Need to know when computer was started.
  2018-10-16 15:36 Is who -b command available? Need to know when computer was started Peder Sverdrup via cygwin
  2018-10-16 16:03 ` john doe
@ 2018-10-16 16:57 ` Gary Johnson
  2018-10-16 17:34   ` EXTERNAL: " Wells, Roger K.
  2018-10-17  2:21   ` Brian Inglis
  2018-10-16 18:54 ` cyg Simple
  2 siblings, 2 replies; 6+ messages in thread
From: Gary Johnson @ 2018-10-16 16:57 UTC (permalink / raw)
  To: cygwin

On 2018-10-16, Peder Sverdrup via cygwin wrote:
> Hi,
> 
> 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.

Regards,
Gary


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: EXTERNAL: Re: Is who -b command available? Need to know when computer was started.
  2018-10-16 16:57 ` Gary Johnson
@ 2018-10-16 17:34   ` Wells, Roger K.
  2018-10-17  2:21   ` Brian Inglis
  1 sibling, 0 replies; 6+ messages in thread
From: Wells, Roger K. @ 2018-10-16 17:34 UTC (permalink / raw)
  To: cygwin

On 10/16/18 12:57 PM, Gary Johnson wrote:
> On 2018-10-16, Peder Sverdrup via cygwin wrote:
>> Hi,
>>
>> 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.
>
> Regards,
> Gary

FWIW
on my cygwin, 2.11.0(0.329/5/3), I have who (GNU coreutils) 8.26.
Of all the options -a/--all gives:
$ who --all
roger    - pty1         2018-10-16 13:05   .           276 (10.40.90.15)
-u, -H, -m, -s, -u gives the same (plus/minus a '-' or '.')
-q seems reasonable, at least similar to the same command on fedora
--version, --help give expected output.
The rest return nothing, including -b


>
> --
> Problem reports:       http://cygwin.com/problems.html
> FAQ:                   http://cygwin.com/faq/
> Documentation:         http://cygwin.com/docs.html
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
>
>

-- 
Roger Wells, P.E.
leidos
221 Third St
Newport, RI 02840
401-847-4210 (voice)
401-849-1585 (fax)
roger.k.wells@leidos.com


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Is who -b command available? Need to know when computer was started.
  2018-10-16 15:36 Is who -b command available? Need to know when computer was started Peder Sverdrup via cygwin
  2018-10-16 16:03 ` john doe
  2018-10-16 16:57 ` Gary Johnson
@ 2018-10-16 18:54 ` cyg Simple
  2 siblings, 0 replies; 6+ messages in thread
From: cyg Simple @ 2018-10-16 18:54 UTC (permalink / raw)
  To: cygwin

On 10/16/2018 11:36 AM, Peder Sverdrup via cygwin wrote:
> Hi,
> 
> 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).
> 

You can do an online search[1] to determine which package to install to
get a binary.  In this case who.exe.

[1] https://cygwin.com/cgi-bin2/package-grep.cgi?grep=who.exe&arch=x86_64

-- 
cyg Simple

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Is who -b command available? Need to know when computer was started.
  2018-10-16 16:57 ` Gary Johnson
  2018-10-16 17:34   ` EXTERNAL: " Wells, Roger K.
@ 2018-10-17  2:21   ` Brian Inglis
  1 sibling, 0 replies; 6+ messages in thread
From: Brian Inglis @ 2018-10-17  2:21 UTC (permalink / raw)
  To: cygwin

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
115395.52 107152.61
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
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-10-17  2:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-16 15:36 Is who -b command available? Need to know when computer was started Peder Sverdrup via cygwin
2018-10-16 16:03 ` john doe
2018-10-16 16:57 ` Gary Johnson
2018-10-16 17:34   ` EXTERNAL: " Wells, Roger K.
2018-10-17  2:21   ` Brian Inglis
2018-10-16 18:54 ` cyg Simple

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).