-#!/usr/bin/perl -w
+#!/usr/bin/perl -w
use strict;
##########################################
# Configuration options:
#
-my $device = "imq0";
-our $rrd_datadir = "/var/log/rrd";
-our $event_datadir = $rrd_datadir;
+my $device = "$ARGV[0]";
+
+our %mainsettings = ();
+require '/var/ipfire/general-functions.pl';
+&General::readhash("${General::swroot}/main/settings", \%mainsettings);
+
+our $rrd_datadir = $mainsettings{'RRDLOG'}."/";
+our $event_datadir = $mainsettings{'RRDLOG'};
our $STEP = 10;
our $tc_command = "/sbin/tc";
my $include_dir = '/var/ipfire/qos/bin';
-# Create the $rrd_datadir if it doesn't exists
-if ( ! -d $rrd_datadir ) {
- print "RRD-datadir not found, creating it: $rrd_datadir \n";
- my $status = system("mkdir $rrd_datadir");
- die "\nERROR cannot create \"$rrd_datadir\"\n" unless $status == 0;
+# Create the $mainsettings{'RRDLOG'} if it doesn't exists
+if ( ! -d $mainsettings{'RRDLOG'} ) {
+ print "RRD-datadir not found, creating it: $mainsettings{'RRDLOG'} \n";
+ my $status = system("mkdir $mainsettings{'RRDLOG'}");
+ die "\nERROR cannot create \"$mainsettings{'RRDLOG'}\"\n" unless $status == 0;
}
# use POSIX;
#
-#POSIX::setsid()
+#POSIX::setsid()
# or die "Can't become a daemon: $!";
# The init scripts will do the right "daemon" thing...
-# Become a daemon
+# Become a daemon
print "Becoming a daemon...\n";
my $pid = fork;
exit if $pid;
#if ( $res ) {
# print " Error updating RRDs: \"$res\"\n";
#}
-
- process_events();
# my $timestamp = time;
# print "$timestamp\n";
-
+
sleep($STEP);
}