diff --git a/Changes b/Changes index 9b80f32..1a6612e 100644 --- a/Changes +++ b/Changes @@ -17,6 +17,9 @@ setup the owner, group and permission bits to that directory every time Monitorix is started. (thanks to Sander Bos for pointing this out) +- Added to restart the HTTP built-in every time Monitorix receives the SIGHUP + signal. This should also fix sporadic hangups in the HTTP and a truncation in + the rotated logfile. - Fixed a bad memory scaling in *BSD systems. - Fixed in 'process.pm' to fully honour the option 'netstats_in_bps'. - Fixed to force Monitorix to be started at the end of boot in systemd-based diff --git a/monitorix b/monitorix index 6dd231c..ebec58b 100755 --- a/monitorix +++ b/monitorix @@ -72,6 +72,8 @@ sub HUP_handler { my ($signal) = @_; my $myself = (caller(0))[3]; + return if $options{n}; # only continue if it's a daemon + my (undef, undef, $uid) = getpwnam($config{httpd_builtin}->{user}); my (undef, undef, $gid) = getgrnam($config{httpd_builtin}->{group}); @@ -85,11 +87,16 @@ sub HUP_handler { chmod(0600, $config{log_file}); logger("$myself: opening a new log file."); - # create the HTTPd logfile - open(OUT, "> " . $config{httpd_builtin}->{log_file}); - close(OUT); - chown($uid, $gid, $config{httpd_builtin}->{log_file}); - chmod(0600, $config{httpd_builtin}->{log_file}); + # restart HTTP built-in + if(lc($config{httpd_builtin}->{enabled}) eq "y") { + if(defined($config{httpd_pid})) { + require HTTPServer; + kill(15, $config{httpd_pid}); + kill(9, $config{httpd_pid}); + httpd_setup(\%config, $options{d}); + logger("Restarted built-in HTTP server (pid $config{httpd_pid}).") if (defined($config{httpd_pid})); + } + } } sub daemonize {