3 # $RCSfile: scan_last,v $$Revision: 4.1 $$Date: 92/08/07 17:20:35 $
5 # This reports who was logged on at weird hours
7 ($dy, $mo, $lastdt) = split(/ +/,`date`);
9 open(Last, 'exec last 2>&1 |') || die "scan_last: can't run last";
12 #if defined(mc300) || defined(mc500) || defined(mc700)
13 $_ = substr($_,0,19) . substr($_,23,100);
16 (print),next if m|^/|;
17 $login = substr($_,0,8);
18 $tty = substr($_,10,7);
19 $from = substr($_,19,15);
20 $day = substr($_,36,3);
21 $mo = substr($_,40,3);
22 $dt = substr($_,44,2);
23 $hr = substr($_,47,2);
24 $min = substr($_,50,2);
25 $dash = substr($_,53,1);
26 $tohr = substr($_,55,2);
27 $tomin = substr($_,58,2);
28 $durhr = substr($_,63,2);
29 $durmin = substr($_,66,2);
32 next if $login eq 'reboot ';
33 next if $login eq 'shutdown';
37 $seen += $dt - $lastdt;
45 $inat = $hr + $min / 60;
46 if ($tohr =~ /^[a-z]/) {
47 $outat = 12; # something innocuous
49 $outat = $tohr + $tomin / 60;
52 last if $seen + ($inat < 8) > 1;
54 if ($inat < 5 || $inat > 21 || $outat < 6 || $outat > 23) {