summaryrefslogtreecommitdiff
path: root/FS/bin/freeside-pingd
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2016-09-29 10:17:55 -0700
committerMark Wells <mark@freeside.biz>2016-09-29 10:17:55 -0700
commit1de48dbd2df88f4ceeedc3e54ce5933bf54c4c84 (patch)
treed59907d8a66194d39dabdd28fad4bb6f1855958a /FS/bin/freeside-pingd
parent2416fc07f8626ac8c3a1db67bb8a3560c05c2736 (diff)
config option to start ping daemon
Diffstat (limited to 'FS/bin/freeside-pingd')
-rw-r--r--FS/bin/freeside-pingd13
1 files changed, 12 insertions, 1 deletions
diff --git a/FS/bin/freeside-pingd b/FS/bin/freeside-pingd
index 8cfb26a5f..fc9f8a378 100644
--- a/FS/bin/freeside-pingd
+++ b/FS/bin/freeside-pingd
@@ -5,6 +5,7 @@ use FS::Daemon ':all';
use FS::UID qw(dbh adminsuidsetup);
use FS::Record qw( dbh qsearch qsearchs );
use FS::addr_status;
+use FS::Conf;
use Getopt::Std;
use Net::Ping;
@@ -14,12 +15,13 @@ my @TARGETS = (
# could add others here
);
-my $interval = 300; # seconds
my $timeout = 5.0; # seconds
# useful opts: scan interval, timeout, verbose, max forks
# maybe useful opts: interface, protocol, packet size, no-fork
+my $interval;
+
our %opt;
getopts('vxi:', \%opt);
my $user = shift or die usage();
@@ -41,6 +43,15 @@ sub debug {
adminsuidsetup($user);
$FS::UID::AutoCommit = 1;
+if ( !$interval ) {
+ my $conf = FS::Conf->new;
+ $interval = $conf->config('pingd-interval');
+ if ( !$interval ) {
+ debug("no pingd-interval configured; exiting");
+ exit(0);
+ }
+}
+
while(1) {
daemon_reconnect();
my @addrs_to_scan;