]>
git.proxmox.com Git - pve-manager.git/blob - bin/pvedaemon
9184d1f281f73cff532faebe570768db27914626
3 $ENV{'PATH'} = '/sbin:/bin:/usr/sbin:/usr/bin';
5 delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
10 use POSIX
":sys_wait_h";
15 my $pidfile = "/var/run/pvedaemon.pid";
16 my $lockfile = "/var/lock/pvedaemon.lck";
20 initlog
('pvedaemon');
22 if (!GetOptions
('debug' => \
$opt_debug)) {
23 die "usage: $0 [--debug]\n";
26 $SIG{'__WARN__'} = sub {
30 syslog
('warning', "WARNING: %s", $t);
36 # create dir for dtach sockets
37 mkdir "/var/run/dtach";
42 $daemon = PVE
::APIDaemon-
>new(
45 trusted_env
=> 1, # partly trusted, because only local programs can connect
46 lockfile
=> $lockfile,
50 max_requests
=> 1000);
56 syslog
('err' , "unable to start server: $err");
61 if ($opt_debug || !($cpid = fork ())) {
63 $SIG{PIPE
} = 'IGNORE';
64 $SIG{INT
} = 'IGNORE' if !$opt_debug;
66 $SIG{TERM
} = $SIG{QUIT
} = sub {
67 syslog
('info' , "server closing");
69 $SIG{INT
} = 'DEFAULT';
76 syslog
('info' , "starting server");
79 # redirect STDIN/STDOUT/SDTERR to /dev/null
80 open STDIN
, '</dev/null' || die "can't read /dev/null [$!]";
81 open STDOUT
, '>/dev/null' || die "can't write /dev/null [$!]";
82 open STDERR
, '>&STDOUT' || die "can't open STDERR to STDOUT [$!]";
87 system ("echo > /var/lib/pve-manager/vmops"); # init vmops file
90 $daemon->start_server();
95 syslog
('err' , "unexpected server error: $err");
96 print STDERR
$err if $opt_debug;
102 open (PIDFILE
, ">$pidfile") ||
103 die "cant write '$pidfile' - $! :ERROR";
104 print PIDFILE
"$cpid\n";
106 die "cant write '$pidfile' - $! :ERROR";
115 pvedaemon - the PVE configuration server
123 All configuration is done using this Server. The Server only
124 listens to a local address 127.0.0.1 port 85 for security
127 =head1 COPYRIGHT AND DISCLAIMER
129 Copyright (C) 2007-2013 Proxmox Server Solutions GmbH
131 This program is free software: you can redistribute it and/or modify it
132 under the terms of the GNU Affero General Public License as published
133 by the Free Software Foundation, either version 3 of the License, or
134 (at your option) any later version.
136 This program is distributed in the hope that it will be useful, but
137 WITHOUT ANY WARRANTY; without even the implied warranty of
138 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
139 Affero General Public License for more details.
141 You should have received a copy of the GNU Affero General Public
142 License along with this program. If not, see
143 <http://www.gnu.org/licenses/>.