sysvinit-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sysvinit-devel] Epoch time in "last" output


From: Steve Parker
Subject: [sysvinit-devel] Epoch time in "last" output
Date: Tue, 22 Jan 2013 20:41:46 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.11) Gecko/20121122 Icedove/10.0.11

Hi sysvinit Developers,

I had a requirement to check for accounts which had not been used in a given time period; last seemed to be a useful tool to do that, but of course its output is in human-readable format and not easily parsed (or at least, not accurately).

I have therefore created the attached patch to src/last.c, against sysvinit-2.88dsf, which adds a "-e" (epoch) switch.

$ ./last -n5
steve    pts/4        :0.0             Tue Jan 22   still    logged in
steve    pts/4        hp               Tue Jan 22 - 17:15     (00:09)
steve    pts/4        hp               Tue Jan 22 - 16:31     (00:06)
steve    pts/4        :0.0             Mon Jan 21 - 23:34     (00:05)
steve    pts/5        :0.0             Mon Jan 21 - 23:34     (00:05)

wtmp begins Wed Jan  2 12:35:41 2013
$ ./last -n5 -e
steve    pts/4        :0.0             1358883350   still    logged in
steve    pts/4        hp               1358874384 1358874925  (00:09)
steve    pts/4        hp               1358871905 1358872289  (00:06)
steve    pts/4        :0.0             1358810967 1358811276  (00:05)
steve    pts/5        :0.0             1358810944 1358811276  (00:05)

wtmp begins Wed Jan  2 12:35:41 2013
$

Comments appreciated, particularly any thoughts about a better way to do the %-10.10s vs %-7.7s sprintf reformatting, and about -F being incompatible with -e - worth testing for?

Steve Parker
address@hidden

Attachment: sysvinit-epoch.diff
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]