mirror of https://github.com/mikaku/Monitorix.git
Restart HTTP built-in on every SIGHUP
Now the HTTP built-in will be restart every time Monitorix received the SIGHUP signal. This should also fix thos annoying sporadic hangups of the HTTP server, and also a truncation in the recent rotated logfile.
This commit is contained in:
parent
d81c5282de
commit
d4d76d775d
3
Changes
3
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
|
||||
|
|
17
monitorix
17
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 {
|
||||
|
|
Loading…
Reference in New Issue