Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
469bfac7
Commit
469bfac7
authored
Oct 06, 2016
by
Leigh B Stoller
Browse files
Fix up exit handling, was failing to kill children.
parent
4cead7b8
Changes
1
Hide whitespace changes
Inline
Side-by-side
event/event_watchdog.in
View file @
469bfac7
...
...
@@ -88,6 +88,17 @@ if (! $debug) {
}
}
#
# Setup a signal handler to kill children and exit.
#
sub
handler
()
{
print
"
Caught a TERM. Killing children and exiting
\n
";
Cleanup
();
exit
(
0
);
}
$SIG
{
TERM
}
=
\
&handler
;
#
# Delay at startup to allow ops time to boot. Hopefully this
# will prevent too many false alarms at system startup time.
...
...
@@ -97,16 +108,6 @@ sleep(60)
my
(
$opswatcher
,
$bosswatcher
,
$psdwatcher
,
$deadpid
);
#
# Setup a signal handler to kill children and exit.
#
sub
handler
()
{
fatal
("
Caught a TERM. Killing children and exiting
\n
")
if
(
$debug
);
}
$SIG
{
TERM
}
=
\
&handler
;
while
(
1
)
{
#
# We look for up to three different pubsubd daemons. One on ops, the
...
...
@@ -258,18 +259,8 @@ sub notify($)
$TBOPS
);
}
sub
fatal
($
)
sub
Cleanup
(
)
{
my
(
$msg
)
=
@_
;
#
# Send a message to the testbed list.
#
SENDMAIL
(
$TBOPS
,
"
Event watchdog daemon died
",
$msg
,
$TBOPS
);
if
(
defined
(
$opswatcher
))
{
kill
('
TERM
',
$opswatcher
);
}
...
...
@@ -281,7 +272,22 @@ sub fatal($)
}
MarkDaemonStopped
("
event_watchdog
")
if
(
!
$debug
);
}
sub
fatal
($)
{
my
(
$msg
)
=
@_
;
#
# Send a message to the testbed list.
#
SENDMAIL
(
$TBOPS
,
"
Event watchdog daemon died
",
$msg
,
$TBOPS
);
Cleanup
();
die
("
*** $0:
\n
"
.
"
$msg
\n
");
}
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