Le 01/01/2014 00:25, insrc a écrit :
Hi,

I'm just wondering if the fusioninventory agent running as a service on
windows can be configured by agent.cfg file  instead of reading its
configuration from the registry please ?

And if "--config=file" is supported on windows, could you please tell me
how to pass this option on the command line when running the windows
installer in silent/unattended mode :-) ?
Hello.

This command line switch is supported on Windows, but there is no way to pass any switch to the service currently...

Feel free to try this patch, if you're interested. You'll have to change the service definition therafter, with a command such as

SC CONFIG AgentServiceName binPath= "C:\path\to\perl.exe c:\path\to\fusioninventory-win32-service --config=file --conf-file=c:\path\to\agent.cfg"

Beware, I didn't tested anything, and I don't know exact service name, nor the exact path to use :)
--
Guillaume

diff --git a/bin/fusioninventory-win32-service b/bin/fusioninventory-win32-service
index 5d222e9..cbb209f 100644
--- a/bin/fusioninventory-win32-service
+++ b/bin/fusioninventory-win32-service
@@ -9,6 +9,8 @@ use constant SERVICE_SLEEP_TIME => 2000; # 20 milliseconds
 
 use File::Spec;
 use File::Basename;
+use Getopt::Long;
+use Pod::Usage;
 
 use English qw(-no_match_vars);
 use Win32;
@@ -19,6 +21,16 @@ use FusionInventory::Agent;
 delete($ENV{PERL5LIB});
 delete($ENV{PERLLIB});
 
+my $options = {
+    service => 1,
+};
+
+GetOptions(
+    $options,
+    'conf-file=s',
+    'config=s',
+) or pod2usage(-verbose => 0);
+
 my $directory = dirname(File::Spec->rel2abs( __FILE__ ));
 # on Win2k, Windows do not chdir to the bin directory
 # we need to do it by ourself
@@ -106,7 +118,7 @@ sub startAgent {
             vardir  => $directory . '/../../var',
             libdir  => $directory . '/../../lib',
         );
-        $agent->init(options => { service => 1 });
+        $agent->init(options => $options);
         $agent->run();
     });
 }
_______________________________________________
Fusioninventory-user mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/fusioninventory-user

Reply via email to