forked from htrgouvea/nipe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nipe.pl
executable file
·49 lines (39 loc) · 851 Bytes
/
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
#!/usr/bin/env perl
use 5.018;
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;
sub main {
my $argument = $ARGV[0];
if ($argument) {
die "Nipe must be run as root.\n" if $> != 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();
exit;