-
-
Notifications
You must be signed in to change notification settings - Fork 321
/
Copy pathnipe.pl
executable file
·51 lines (40 loc) · 1.04 KB
/
nipe.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env perl
use 5.030;
use strict;
use warnings;
use Try::Tiny;
use lib './lib/';
use Nipe::Engine::Stop;
use Nipe::Engine::Start;
use Nipe::Engine::Restart;
use Nipe::Utils::Status;
use Nipe::Utils::Helper;
use Nipe::Utils::Install;
use English '-no_match_vars';
our $VERSION = '0.0.4';
sub main {
my $argument = $ARGV[0];
if ($argument) {
die "Nipe must be run as root.\n" if $REAL_USER_ID != 0;
my $commands = {
stop => 'Nipe::Engine::Stop',
start => 'Nipe::Engine::Start',
status => 'Nipe::Utils::Status',
restart => 'Nipe::Engine::Restart',
install => 'Nipe::Utils::Install',
help => 'Nipe::Utils::Helper'
};
try {
my $exec = $commands -> {$argument} -> new();
if ($exec ne 1) {
print $exec;
}
}
catch {
print "\n[!] ERROR: this command could not be run\n\n";
};
return 1;
}
return print Nipe::Utils::Helper->new();
}
main();