startup.pl 1.05 KB
Newer Older
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
#!/usr/bin/perl -w

use strict;

use PVE::SafeSyslog;

use ModPerl::Util (); #for CORE::GLOBAL::exit

use Apache2::RequestRec ();
use Apache2::RequestIO ();
use Apache2::RequestUtil ();
use Apache2::Access;
use Apache2::Response;
use Apache2::Util;
  
use Apache2::ServerUtil ();
use Apache2::Connection ();
use Apache2::Log ();
  
use APR::Table ();
  
use ModPerl::Registry ();
  
use Apache2::Const -compile => ':common';
use APR::Const -compile => ':common';

initlog ('proxwww', 'daemon');

use PVE::pvecfg;
use PVE::REST;
use PVE::Cluster;
use PVE::INotify;
use PVE::RPCEnvironment;

sub childinit {
36
    # syslog ('info', "Starting new child $$");
37

38 39 40 41 42 43
    eval {
	PVE::INotify::inotify_init();
	PVE::RPCEnvironment->init('pub');
    };
    my $err = $@;
    syslog('err', $err) if $err;
44 45 46
}

sub childexit {
47
    # BUG: seems this is not called if we do $r->child_terminate()
48
    # syslog ('info', "Finish child $$");
49 50 51 52 53 54 55 56
}

my $s = Apache2::ServerUtil->server;
$s->push_handlers(PerlChildInitHandler => \&childinit);
$s->push_handlers(PerlChildExitHandler => \&childexit);

1;