]>
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";
16 my $pidfile = "/var/run/pvedaemon.pid";
17 my $lockfile = "/var/lock/pvedaemon.lck";
21 initlog
('pvedaemon');
23 if (!GetOptions
('debug' => \
$opt_debug)) {
24 die "usage: $0 [--debug]\n";
27 $SIG{'__WARN__'} = sub {
31 syslog
('warning', "WARNING: %s", $t);
37 # create dir for dtach sockets
38 mkdir "/var/run/dtach";
43 $daemon = PVE
::APIDaemon-
>new(
44 base_handler_class
=> 'PVE::API2',
47 trusted_env
=> 1, # partly trusted, because only local programs can connect
48 lockfile
=> $lockfile,
52 max_requests
=> 1000);
58 syslog
('err' , "unable to start server: $err");
63 if ($opt_debug || !($cpid = fork ())) {
65 $SIG{PIPE
} = 'IGNORE';
66 $SIG{INT
} = 'IGNORE' if !$opt_debug;
68 $SIG{TERM
} = $SIG{QUIT
} = sub {
69 syslog
('info' , "server closing");
71 $SIG{INT
} = 'DEFAULT';
78 syslog
('info' , "starting server");
81 # redirect STDIN/STDOUT/SDTERR to /dev/null
82 open STDIN
, '</dev/null' || die "can't read /dev/null [$!]";
83 open STDOUT
, '>/dev/null' || die "can't write /dev/null [$!]";
84 open STDERR
, '>&STDOUT' || die "can't open STDERR to STDOUT [$!]";
89 system ("echo > /var/lib/pve-manager/vmops"); # init vmops file
92 $daemon->start_server();
97 syslog
('err' , "unexpected server error: $err");
98 print STDERR
$err if $opt_debug;
104 open (PIDFILE
, ">$pidfile") ||
105 die "cant write '$pidfile' - $! :ERROR";
106 print PIDFILE
"$cpid\n";
108 die "cant write '$pidfile' - $! :ERROR";
117 pvedaemon - the PVE configuration server
125 All configuration is done using this Server. The Server only
126 listens to a local address 127.0.0.1 port 85 for security
129 =head1 COPYRIGHT AND DISCLAIMER
131 Copyright (C) 2007-2013 Proxmox Server Solutions GmbH
133 This program is free software: you can redistribute it and/or modify it
134 under the terms of the GNU Affero General Public License as published
135 by the Free Software Foundation, either version 3 of the License, or
136 (at your option) any later version.
138 This program is distributed in the hope that it will be useful, but
139 WITHOUT ANY WARRANTY; without even the implied warranty of
140 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
141 Affero General Public License for more details.
143 You should have received a copy of the GNU Affero General Public
144 License along with this program. If not, see
145 <http://www.gnu.org/licenses/>.