diff options
author | Niko Tyni <ntyni@iki.fi> | 2005-10-11 21:19:23 +0200 |
---|---|---|
committer | Niko Tyni <ntyni@iki.fi> | 2005-10-11 21:19:23 +0200 |
commit | bb33fa999a13290f612e9af05b7ce113c22d1140 (patch) | |
tree | 84fd7596e4ebcf8ad6ff873a584dad58e3c5d3d3 /lib/Smokeping.pm | |
parent | 9c0ca72bea9a83cdefa5d91461160dc9867bd2e9 (diff) | |
download | smokeping-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)
Diffstat (limited to 'lib/Smokeping.pm')
-rw-r--r-- | lib/Smokeping.pm | 13 |
1 files changed, 8 insertions, 5 deletions
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."); |