Subversion Repositories sysadmin_scripts

Rev

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

Rev 61 Rev 148
Line 26... Line 26...
26
#       Created copyright using GNUv2
26
#       Created copyright using GNUv2
27
#    v0.2.1 - 20191209 RWR
27
#    v0.2.1 - 20191209 RWR
28
#       Since the openvpn cli does not return any exit codes (always 0), set it to monitor
28
#       Since the openvpn cli does not return any exit codes (always 0), set it to monitor
29
#       the logs, looking for. See sub verifyUp for details.
29
#       the logs, looking for. See sub verifyUp for details.
30
 
30
 
-
 
31
# On secure systems, you can set this up with the setuid bit to run as root
-
 
32
# chown root:root vpn
-
 
33
# chmod u+s vpn
-
 
34
 
31
 
35
 
32
$main::VERSION = '0.2.1';
36
$main::VERSION = '0.2.1';
33
 
37
 
34
 
38
 
35
use Getopt::Long qw(:config auto_version bundling );
39
use Getopt::Long qw(:config auto_version bundling );
Line 127... Line 131...
127
sub printSessions {
131
sub printSessions {
128
   my $sessions = &getSessions();
132
   my $sessions = &getSessions();
129
   print '-'x40 . "\nActive\tSession\t\tPID\n";
133
   print '-'x40 . "\nActive\tSession\t\tPID\n";
130
   foreach my $session ( sort keys %$sessions ) {
134
   foreach my $session ( sort keys %$sessions ) {
131
      print $$sessions{$session}{'pid'} ? "*" : " ";
135
      print $$sessions{$session}{'pid'} ? "*" : " ";
132
      print "\t$session" . ' 'x (15 - length( $session ));
136
      print "\t$session" . ' 'x (length($session) < 25 ? 25 - length( $session ) : 25);
133
      if ( $$sessions{$session}{'pid'} ) {
137
      if ( $$sessions{$session}{'pid'} ) {
134
         print "\t" . $$sessions{$session}{'pid'};
138
         print "\t" . $$sessions{$session}{'pid'};
135
      }
139
      }
136
      print "\n";
140
      print "\n";
137
   }
141
   }