#!/usr/bin/perl -w
use
lib
"$FindBin::Bin/../blib/lib"
;
sub
usage {
Pod::Usage::pod2usage( {
-exitval
=> 1,
-verbose
=> 1 } );
}
my
$apache
= App::CamelPKI->model(
"WebServer"
)->apache;
die
<<"MESSAGE" if (! $apache->is_operational);
The Key Ceremony has not been performed yet, and so it is not possible
to start Apache. Please, run the camel_pki_keyceremony.pl script first.
MESSAGE
if
(
@ARGV
> 1 &&
$ARGV
[
$#ARGV
- 1] eq
"-fullname"
) {
@ARGV
= (
$ARGV
[
$#ARGV
]);
}
usage
unless
@ARGV
== 1;
if
(
$ARGV
[0] eq
"start"
) {
try
{
$apache
->start;
}
catch
App::CamelPKI::Error::OtherProcess
with
{
die
<<"MESSAGE" if $apache->is_wedged;
Apache is in an incorrect status, please stop it manually to solve
the issue by yourself.
MESSAGE
die
"Could not start Apache: "
.
$apache
->tail_error_logfile();
};
}
elsif
(
$ARGV
[0] eq
"stop"
) {
$apache
->stop;
}
elsif
(
$ARGV
[0] eq
"restart"
) {
$apache
->stop;
$apache
->start;
}
elsif
(
$ARGV
[0] eq
"gdbstart"
) {
$apache
->start(
-gdb
=> 1,
-X
=> 1,
-exec
=> 1);
}
else
{
usage;
}
exit
(0);