#!/usr/bin/env perl
#
# start_server.pl - start,stop,restart
#
use strict;
use warnings;
use Yote;
my $args = Yote::get_args();
my $config = $args->{ config };
my $cmd = $args->{ command };
my $yote_root_dir = $config->{ yote_root };
eval {
$SIG{ __DIE__ } = sub {
Carp::confess( @_ );
};
my $s = Yote::run(
%$config
);
$SIG{TERM} = sub {
$s->shutdown();
print STDERR "Shutting down due to term\n";
exit;
};
$SIG{INT} = sub {
$s->shutdown();
print STDERR "Shutting down due to int\n";
exit;
};
$SIG{CHLD} = sub {
print STDERR "Got CHLD\n";
#this is important. I may be able to handle the occasional crashing of the web server process right here!
print STDERR Data::Dumper->Dump(["GOT SIG CHLD", $config]);
};
$SIG{PIPE} = sub {};
};
if( $@ ) {
print STDERR Data::Dumper->Dump([$@,"ERR"]);
}
__END__