From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 66435 invoked by alias); 17 Oct 2018 02:21:52 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 66400 invoked by uid 89); 17 Oct 2018 02:21:50 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=discretion, brian, readers, Hx-spam-relays-external:shaw.ca X-HELO: smtp-out-no.shaw.ca Received: from smtp-out-no.shaw.ca (HELO smtp-out-no.shaw.ca) (64.59.134.9) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 17 Oct 2018 02:21:48 +0000 Received: from [192.168.1.114] ([24.64.240.204]) by shaw.ca with ESMTP id CbSzg44dwWppDCbT0gS6pY; Tue, 16 Oct 2018 20:21:47 -0600 Reply-To: Brian.Inglis@SystematicSw.ab.ca Subject: Re: Is who -b command available? Need to know when computer was started. To: cygwin@cygwin.com References: <014001d46565$feedda10$fcc98e30$@yahoo.com> <20181016165745.GA1226@phoenix> From: Brian Inglis Openpgp: preference=signencrypt Message-ID: <48af28ec-153c-5ac3-6bf5-eb40f4eac297@SystematicSw.ab.ca> Date: Wed, 17 Oct 2018 02:21:00 -0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20181016165745.GA1226@phoenix> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2018-10/txt/msg00145.txt.bz2 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