Subversion Repositories sysadmin_scripts

Rev

Rev 148 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 148 Rev 149
Line 3... Line 3...
3
use strict;
3
use strict;
4
use warnings;
4
use warnings;
5
 
5
 
6
use File::Slurp; # apt install -y libfile-slurp-perl
6
use File::Slurp; # apt install -y libfile-slurp-perl
7
 
7
 
-
 
8
# It is difficult to tell who is on line with a UI based Linux system
-
 
9
# as all the cli functions assume the other are logged in via cli.
-
 
10
#
-
 
11
# This script determines all "real users" (UUID > 1000, but not 'nobody')
-
 
12
# and then does a ps aux to see if any of them are online.
-
 
13
 
-
 
14
 
-
 
15
# Copyright 2024 Daily Data, Inc.
-
 
16
# 
-
 
17
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following 
-
 
18
# conditions are met:
-
 
19
#
-
 
20
#   Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-
 
21
#   Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer 
-
 
22
#   in the documentation and/or other materials provided with the distribution.
-
 
23
#   Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
-
 
24
#   from this software without specific prior written permission.
-
 
25
# 
-
 
26
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
-
 
27
# NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
-
 
28
# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-
 
29
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-
 
30
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-
 
31
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
 
32
 
-
 
33
# define the version number
-
 
34
# see https://metacpan.org/pod/release/JPEACOCK/version-0.97/lib/version.pod
-
 
35
use version;
-
 
36
our $VERSION = version->declare("0.0.1");
-
 
37
 
8
my @users;
38
my @users;
9
 
39
 
10
my @passwords = read_file( '/etc/passwd' );
40
my @passwords = read_file( '/etc/passwd' );
11
while ( my $line = pop @passwords ) {
41
while ( my $line = pop @passwords ) {
12
   next if $line =~ m/^#/;
42
   next if $line =~ m/^#/;