mirror of
https://github.com/bvanroll/_dotfiles.git
synced 2025-08-29 20:12:42 +00:00
24 lines
462 B
Perl
Executable File
24 lines
462 B
Perl
Executable File
#!/usr/bin/env perl
|
|
|
|
use strict;
|
|
use warnings;
|
|
use utf8;
|
|
|
|
use JSON::Parse 'parse_json';
|
|
|
|
my $units = parse_json(`systemctl list-units --output=json --state=active 'openvpn-client@*'`);
|
|
|
|
if (@$units) {
|
|
my @names = sort map {
|
|
$_->{unit} =~ /^openvpn-client@(.*)\.service$/;
|
|
$1;
|
|
} @$units;
|
|
print join(' ', @names) . "\n";
|
|
print "up\n";
|
|
print "#00FF00\n";
|
|
} else {
|
|
print "down\n";
|
|
print "down\n";
|
|
print "#FF0000\n";
|
|
}
|