summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiko Tyni <ntyni@iki.fi>2005-10-11 21:19:23 +0200
committerNiko Tyni <ntyni@iki.fi>2005-10-11 21:19:23 +0200
commitbb33fa999a13290f612e9af05b7ce113c22d1140 (patch)
tree84fd7596e4ebcf8ad6ff873a584dad58e3c5d3d3
parent9c0ca72bea9a83cdefa5d91461160dc9867bd2e9 (diff)
downloadsmokeping-bb33fa999a13290f612e9af05b7ce113c22d1140.tar.gz
smokeping-bb33fa999a13290f612e9af05b7ce113c22d1140.tar.xz
* (trunk)/
lib/Smokeping.pm, CHANGES: + avoid creating new RRD files as the user running 'smokeping --reload' (merged from 2.0)
-rw-r--r--CHANGES4
-rw-r--r--lib/Smokeping.pm13
2 files changed, 12 insertions, 5 deletions
diff --git a/CHANGES b/CHANGES
index d462f22..0f9d4a6 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,7 @@
+* avoid creating new RRD files as the user running 'smokeping --reload'
+ -- niko, reported by Stefan Schmidt <s.schmidt *mcbone.net>,
+ http://bugs.debian.org/333373
+
2005/10/11 -- released version 20051011_trunk
2005/10/10 -- released version 20051010_trunk
diff --git a/lib/Smokeping.pm b/lib/Smokeping.pm
index 5686866..064e8fe 100644
--- a/lib/Smokeping.pm
+++ b/lib/Smokeping.pm
@@ -2552,8 +2552,9 @@ sub daemonize_me ($) {
my $RCS_VERSION = '$Id: Smokeping.pm,v 1.5 2004/10/21 21:10:51 oetiker Exp $';
-sub load_cfg ($) {
+sub load_cfg ($;$) {
my $cfgfile = shift;
+ my $noinit = shift;
my $cfmod = (stat $cfgfile)[9] || die "ERROR: calling stat on $cfgfile: $!\n";
# when running under speedy this will prevent reloading on every run
# if cfgfile has been modified we will still run.
@@ -2567,6 +2568,7 @@ sub load_cfg ($) {
$probes = undef;
$probes = load_probes $cfg;
$cfg->{__probes} = $probes;
+ return if $noinit;
init_alerts $cfg if $cfg->{Alerts};
init_target_tree $cfg, $probes, $cfg->{Targets}, $cfg->{General}{datadir};
} else {
@@ -2903,15 +2905,16 @@ sub main (;$) {
initialize_debuglog if $opt{debug} or $opt{'debug-daemon'};
my $cfgfile = $opt{config} || $defaultcfg;
if(defined $opt{'check'}) { verify_cfg($cfgfile); exit 0; }
- load_cfg $cfgfile;
- if(defined $opt{'static-pages'}) { makestaticpages $cfg, $opt{'static-pages'}; exit 0 };
- if($opt{email}) { enable_dynamic $cfg, $cfg->{Targets},"",""; exit 0 };
- if($opt{restart}) { kill_smoke $cfg->{General}{piddir}."/smokeping.pid", SIGINT;};
if($opt{reload}) {
+ load_cfg $cfgfile, 'noinit'; # we need just the piddir
kill_smoke $cfg->{General}{piddir}."/smokeping.pid", SIGHUP;
print "HUP signal sent to the running SmokePing process, exiting.\n";
exit 0;
};
+ load_cfg $cfgfile;
+ if(defined $opt{'static-pages'}) { makestaticpages $cfg, $opt{'static-pages'}; exit 0 };
+ if($opt{email}) { enable_dynamic $cfg, $cfg->{Targets},"",""; exit 0 };
+ if($opt{restart}) { kill_smoke $cfg->{General}{piddir}."/smokeping.pid", SIGINT;};
if($opt{logfile}) { initialize_filelog($opt{logfile}) };
if (not keys %$probes) {
do_log("No probes defined, exiting.");