Revision: 610
http://openautomation.svn.sourceforge.net/openautomation/?rev=610&view=rev
Author: mayerch
Date: 2011-12-26 15:46:24 +0000 (Mon, 26 Dec 2011)
Log Message:
-----------
Add missing function to read config file
Modified Paths:
--------------
wiregate/plugin/generic/Russound_RIO.pl
Modified: wiregate/plugin/generic/Russound_RIO.pl
===================================================================
--- wiregate/plugin/generic/Russound_RIO.pl 2011-12-26 15:26:55 UTC (rev 609)
+++ wiregate/plugin/generic/Russound_RIO.pl 2011-12-26 15:46:24 UTC (rev 610)
@@ -22,12 +22,40 @@
my $reset ; # set to 1 to reset the states, run script and change to 0 again
my $show_debug; # switches debug information that will be shown in the log
-
#############################################################################
# Do NOT change anything below!
#############################################################################
#############################################################################
+# Read config file in conf.d
+my $confFile = '/etc/wiregate/plugin/generic/conf.d/'.basename($plugname,'.pl').'.conf';
+if (! -f $confFile)
+{
+ plugin_log($plugname, " no conf file [$confFile] found.");
+}
+else
+{
+ plugin_log($plugname, " reading conf file [$confFile].") if( $show_debug > 1);
+ open(CONF, $confFile);
+ my @lines = <CONF>;
+ close($confFile);
+ my $result = eval("@lines");
+ if( $show_debug > 1 )
+ {
+ ($result) and plugin_log($plugname, "conf file [$confFile] returned result[$result]");
+ }
+ if ($@)
+ {
+ plugin_log($plugname, "conf file [$confFile] returned:") if( $show_debug > 1 );
+ my @parts = split(/\n/, $@);
+ if( $show_debug > 1 )
+ {
+ plugin_log($plugname, "--> $_") foreach (@parts);
+ }
+ }
+}
+
+#############################################################################
# External libraries:
use Net::Telnet ();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|