From 8b7a7b9678df5e2b3571542dcd3181bba99271c7 Mon Sep 17 00:00:00 2001 From: Sergey Ivanov <seriv@cs.umd.edu> Date: Mon, 12 Apr 2021 12:11:17 -0400 Subject: [PATCH] pay attention to the child --- resmon | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/resmon b/resmon index ac04326..da6f4a6 100755 --- a/resmon +++ b/resmon @@ -99,6 +99,13 @@ $status->serve_http_on($config->{interface}, $config->{port}, if($config->{port}); while(1) { + my $child_status = waitpid ($status->{child}, WNOHANG); + if ($child_status == -1) { + die "Error occured: ", $? >> 8; + } + elsif ($child_status) { + die "HTTP server ended with ", $? >> 8; + } while(my($module_name, $mod_configs) = each %{$config->{Module}}) { while(my($check_name, $monitor_obj) = each %$mod_configs) { my $check_metrics = {}; -- GitLab