pve-manager/bin/pveproxy

32 lines
707 B
Plaintext
Raw Normal View History

#!/usr/bin/perl -T
2013-04-05 18:44:21 +04:00
$ENV{'PATH'} = '/sbin:/bin:/usr/sbin:/usr/bin';
delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
use strict;
use warnings;
2015-01-01 18:19:41 +03:00
use PVE::SafeSyslog;
use PVE::Service::pveproxy;
2013-04-05 18:44:21 +04:00
$SIG{'__WARN__'} = sub {
my $err = $@;
my $t = $_[0];
chomp $t;
2015-01-01 18:19:41 +03:00
print STDERR "$t\n";
syslog('warning', "%s", $t);
2013-04-05 18:44:21 +04:00
$@ = $err;
};
my $prepare = sub {
my $rundir="/var/run/pveproxy";
if (mkdir($rundir, 0700)) { # only works at first start if we are root)
my $gid = getgrnam('www-data') || die "getgrnam failed - $!\n";
my $uid = getpwnam('www-data') || die "getpwnam failed - $!\n";
chown($uid, $gid, $rundir);
}
2015-01-01 18:19:41 +03:00
};
2013-04-05 18:44:21 +04:00
PVE::Service::pveproxy->run_cli_handler(prepare => $prepare);