]>
git.proxmox.com Git - pve-manager.git/blob - bin/pvedaemon
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 use PVE
::API2
::Formatter
::Standard
;
16 use PVE
::API2
::Formatter
::HTML
;
18 my $pidfile = "/var/run/pvedaemon.pid";
19 my $lockfile = "/var/lock/pvedaemon.lck";
23 initlog
('pvedaemon');
25 if (!GetOptions
('debug' => \
$opt_debug)) {
26 die "usage: $0 [--debug]\n";
29 $SIG{'__WARN__'} = sub {
33 syslog
('warning', "WARNING: %s", $t);
39 # create dir for dtach sockets
40 mkdir "/var/run/dtach";
45 $daemon = PVE
::APIDaemon-
>new(
46 base_handler_class
=> 'PVE::API2',
49 trusted_env
=> 1, # partly trusted, because only local programs can connect
50 lockfile
=> $lockfile,
54 max_requests
=> 1000);
60 syslog
('err' , "unable to start server: $err");
65 if ($opt_debug || !($cpid = fork ())) {
67 $SIG{PIPE
} = 'IGNORE';
68 $SIG{INT
} = 'IGNORE' if !$opt_debug;
70 $SIG{TERM
} = $SIG{QUIT
} = sub {
71 syslog
('info' , "server closing");
73 $SIG{INT
} = 'DEFAULT';
80 syslog
('info' , "starting server");
83 # redirect STDIN/STDOUT/SDTERR to /dev/null
84 open STDIN
, '</dev/null' || die "can't read /dev/null [$!]";
85 open STDOUT
, '>/dev/null' || die "can't write /dev/null [$!]";
86 open STDERR
, '>&STDOUT' || die "can't open STDERR to STDOUT [$!]";
91 system ("echo > /var/lib/pve-manager/vmops"); # init vmops file
94 $daemon->start_server();
99 syslog
('err' , "unexpected server error: $err");
100 print STDERR
$err if $opt_debug;
106 open (PIDFILE
, ">$pidfile") ||
107 die "cant write '$pidfile' - $! :ERROR";
108 print PIDFILE
"$cpid\n";
110 die "cant write '$pidfile' - $! :ERROR";
119 pvedaemon - the PVE configuration server
127 All configuration is done using this Server. The Server only
128 listens to a local address 127.0.0.1 port 85 for security
131 =head1 COPYRIGHT AND DISCLAIMER
133 Copyright (C) 2007-2013 Proxmox Server Solutions GmbH
135 This program is free software: you can redistribute it and/or modify it
136 under the terms of the GNU Affero General Public License as published
137 by the Free Software Foundation, either version 3 of the License, or
138 (at your option) any later version.
140 This program is distributed in the hope that it will be useful, but
141 WITHOUT ANY WARRANTY; without even the implied warranty of
142 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
143 Affero General Public License for more details.
145 You should have received a copy of the GNU Affero General Public
146 License along with this program. If not, see
147 <http://www.gnu.org/licenses/>.