mirror of
https://github.com/webmin/webmin.git
synced 2026-02-08 00:12:14 +00:00
Compare commits
3 Commits
dev/fix-la
...
dev/fix-la
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4006b0454e | ||
|
|
5d4ab58baa | ||
|
|
e6c7a60fe6 |
@@ -21,7 +21,8 @@ return 0;
|
||||
sub open_last_command
|
||||
{
|
||||
local ($fh, $user) = @_;
|
||||
open($fh, "last $user |");
|
||||
local $quser = quotemeta($user);
|
||||
open($fh, "(last -w $quser || last $quser) |");
|
||||
}
|
||||
|
||||
# read_last_line(handle)
|
||||
@@ -34,7 +35,9 @@ while(1) {
|
||||
chop($line = <$fh>);
|
||||
if (!$line) { return (); }
|
||||
if ($line =~ /^(reboot|shutdown)/) { next; }
|
||||
if ($line =~ /^(\S+)\s+(\S+)\s+(\S+)?\s+(\S+\s+\S+\s+\d+\s+\d+:\d+)\s+\-\s+(\S+)\s+\((\d+:\d+)\)/) {
|
||||
if ($line =~ /^(\S+)\s+(\S+)\s+(\S+)?\s+(\S+\s+\S+\s+\d+\s+\d+:\d+)\s+\-\s+(\S+)\s+\((.*?\d+:\d+.*?)\)/) {
|
||||
# root pts/0 10.211.55.2 Tue Nov 22 21:06 - 23:16 (02:10:00)
|
||||
# root pts/1 10.211.55.2 Wed Jun 29 13:13 - shutdown (7+00:01:20)
|
||||
return ($1, $2, $3, $4, $5 eq "shutdown" ? "Shutdown" :
|
||||
$5 eq "crash" ? "Crash" : $5, $6);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user