summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: bbb8999)
raw | patch | inline | side by side (parent: bbb8999)
author | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 5 Dec 2007 16:08:46 +0000 (16:08 +0000) | ||
committer | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 5 Dec 2007 16:08:46 +0000 (16:08 +0000) |
ip and mac address have no longe be defined in cfg file
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8028 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8028 594d385d-05f5-0310-b6e9-bd551577e9d8
contrib/daemon/gosa-sd | patch | blob | history | |
contrib/daemon/gosa-sd.cfg-template | patch | blob | history |
diff --git a/contrib/daemon/gosa-sd b/contrib/daemon/gosa-sd
index b02c314171ccca0898288ece556b2ac6738796e3..613987bad545aa1ad86014d51eb4673c46a1fe60 100755 (executable)
--- a/contrib/daemon/gosa-sd
+++ b/contrib/daemon/gosa-sd
my ($cfg_file, %cfg_defaults, $foreground, $verbose, $ping_timeout);
my ($bus, $msg_to_bus, $bus_cipher);
-my ($server, $server_mac, $server_events);
+my ($server, $server_mac_address, $server_events);
my ($gosa_server);
my ($known_daemons, $shmda, $known_clients, $shmcl, $known_modules);
my ($max_clients);
}
+#=== FUNCTION ================================================================
+# NAME: get_ip_and_mac
+# PARAMETERS: nothing
+# RETURNS: (ip, mac)
+# DESCRIPTION: executes /sbin/ifconfig and parses the output, the first occurence
+# of a inet address is returned as well as the mac address in the line
+# above the inet address
+#===============================================================================
+sub get_ip_and_mac {
+ my $ip = "0.0.0.0.0"; # Defualt-IP
+ my $mac = "00:00:00:00:00:00"; # Default-MAC
+ my @ifconfig = qx(/sbin/ifconfig);
+ foreach(@ifconfig) {
+ if (/Hardware Adresse (\S{2}):(\S{2}):(\S{2}):(\S{2}):(\S{2}):(\S{2})/) {
+ $mac = "$1:$2:$3:$4:$5:$6";
+ next;
+ }
+ if (/inet Adresse:(\d+).(\d+).(\d+).(\d+)/) {
+ $ip = "$1.$2.$3.$4";
+ last;
+ }
+ }
+ return ($ip, $mac);
+}
+
+
+
#=== FUNCTION ================================================================
# NAME: import_modules
# PARAMETERS: module_path - string - abs. path to the directory the modules are stored
if( !$foreground ) { exit( 0 ) };
}
+# detect own ip and mac address
+($server_ip, $server_mac_address) = &get_ip_and_mac();
+if (not defined $server_ip) {
+ die "EXIT: ip address of $0 could not be detected";
+}
+daemon_log("server ip address detected: $server_ip", 1);
+daemon_log("server mac address detected: $server_mac_address", 1);
+
# setup xml parser
$xml = new XML::Simple();
index 3ccaaaba7957f725b7a43b1b0063289ac5437af4..56f57c992a04a6611921be9af208e5fb1dbbe054 100644 (file)
[server]
server_activ = on
-server_ip = 10.89.1.155
server_port = 10001
server_passwd = tester
max_clients = 5