2019-11-27 07:09:29 -08:00
|
|
|
#!/usr/bin/env perl
|
2015-09-07 12:14:40 -07:00
|
|
|
|
2020-01-02 03:37:26 -08:00
|
|
|
use 5.018;
|
2020-05-27 05:59:12 -07:00
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
use Try::Tiny;
|
2016-06-29 18:59:50 -07:00
|
|
|
use lib "./lib/";
|
2020-03-12 06:22:12 -07:00
|
|
|
use Nipe::Engine::Stop;
|
|
|
|
use Nipe::Engine::Start;
|
|
|
|
use Nipe::Engine::Restart;
|
|
|
|
use Nipe::Utils::Status;
|
|
|
|
use Nipe::Utils::Helper;
|
|
|
|
use Nipe::Utils::Install;
|
2015-09-07 12:14:40 -07:00
|
|
|
|
2016-08-19 14:49:03 -07:00
|
|
|
sub main {
|
2020-06-07 04:15:27 -07:00
|
|
|
my $argument = $ARGV[0];
|
2020-06-11 08:59:10 -07:00
|
|
|
|
2020-05-27 05:59:12 -07:00
|
|
|
if ($argument) {
|
2020-06-27 08:27:08 -07:00
|
|
|
die "Nipe must be run as root.\n" if $> != 0;
|
|
|
|
|
2020-05-27 05:59:12 -07:00
|
|
|
my $commands = {
|
2020-06-07 04:15:27 -07:00
|
|
|
stop => "Nipe::Engine::Stop",
|
2020-05-27 05:59:12 -07:00
|
|
|
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;
|
|
|
|
}
|
2017-04-21 05:19:12 -07:00
|
|
|
}
|
2020-06-07 04:15:27 -07:00
|
|
|
|
2020-05-27 05:59:12 -07:00
|
|
|
catch {
|
|
|
|
print "\n[!] ERROR: this command could not be run\n\n";
|
|
|
|
};
|
2017-04-21 05:19:12 -07:00
|
|
|
|
2020-05-27 05:59:12 -07:00
|
|
|
return 1;
|
2016-08-19 14:49:03 -07:00
|
|
|
}
|
2020-06-07 04:15:27 -07:00
|
|
|
|
2020-05-27 05:59:12 -07:00
|
|
|
return print Nipe::Utils::Helper -> new();
|
2016-02-12 16:51:41 -08:00
|
|
|
}
|
2016-08-19 14:49:03 -07:00
|
|
|
|
|
|
|
main();
|
2020-06-07 04:15:27 -07:00
|
|
|
exit;
|