nipe/nipe.pl

50 lines
851 B
Perl
Raw Permalink Normal View History

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;
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
sub main {
my $argument = $ARGV[0];
2020-06-11 08:59:10 -07:00
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;
}
2017-04-21 05:19:12 -07:00
}
catch {
print "\n[!] ERROR: this command could not be run\n\n";
};
2017-04-21 05:19:12 -07:00
return 1;
}
return print Nipe::Utils::Helper -> new();
}
main();
exit;