Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pve-manager
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
pve-manager
Commits
f76dbc2d
Commit
f76dbc2d
authored
Dec 20, 2014
by
Dietmar Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
APIDaemon: fix signal handling
and make sure we do not open inotify handle twice
parent
dd089e23
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
1 deletion
+15
-1
APIDaemon.pm
PVE/APIDaemon.pm
+15
-1
No files found.
PVE/APIDaemon.pm
View file @
f76dbc2d
...
...
@@ -7,6 +7,7 @@ use Socket qw(IPPROTO_TCP TCP_NODELAY SOMAXCONN);
use
IO::Socket::
INET
;
use
Net::
IP
;
use
PVE::
INotify
;
use
PVE::
SafeSyslog
;
use
PVE::
HTTPServer
;
...
...
@@ -104,7 +105,14 @@ sub start_workers {
}
else
{
$0
=
"
$0 worker
";
$SIG
{
TERM
}
=
$SIG
{
QUIT
}
=
'
DEFAULT
';
# we handle that with AnyEvent
PVE::INotify::
inotify_close
();
for
my
$sig
(
qw(CHLD HUP INT TERM QUIT)
)
{
$SIG
{
$sig
}
=
'
DEFAULT
';
# restore default handler
# AnyEvent signals only works if $SIG{XX} is
# undefined (perl event loop)
delete
$SIG
{
$sig
};
# so that we can handle events with AnyEvent
}
eval
{
my
$server
=
PVE::
HTTPServer
->
new
(
%
{
$self
->
{
cfg
}});
...
...
@@ -114,6 +122,8 @@ sub start_workers {
syslog
('
err
',
$err
);
sleep
(
5
);
# avoid fast restarts
}
syslog
('
info
',
"
worker exit
");
exit
(
0
);
}
}
...
...
@@ -176,6 +186,10 @@ sub start_server {
terminate_server
();
&
$old_sig_term
(
@_
)
if
$old_sig_term
;
};
local
$SIG
{
INT
}
=
sub
{
terminate_server
();
&
$old_sig_term
(
@_
)
if
$old_sig_term
;
};
local
$SIG
{
HUP
}
=
sub
{
syslog
("
info
",
"
received reload request
");
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment