diff --git a/gosa-si/gosa-si-client b/gosa-si/gosa-si-client
index 6675b6ae3cbabaecb18f56cc85b44062817cc5ac..56200d9964557078bc8530c094f7acf8de4b250f 100755 (executable)
--- a/gosa-si/gosa-si-client
+++ b/gosa-si/gosa-si-client
use IO::Socket::INET;
use NetAddr::IP;
use Crypt::Rijndael;
-use GOsaSI::GosaSupportDaemon;
use Digest::MD5 qw(md5_hex md5 md5_base64);
use MIME::Base64;
use XML::Simple;
use File::Spec;
use File::Pid;
use Net::ARP;
+use GOsaSI::GosaSupportDaemon;
use POE qw(Component::Server::TCP Wheel::FollowTail Wheel::Run);
use Fcntl;
my $event_dir = "/usr/lib/gosa-si/client/events";
use lib "/usr/lib/gosa-si/client/events";
-my (%cfg_defaults, $foreground, $verbose, $pid_file, $procid, $pid, $log_file, $fai_logpath);
+my (%cfg_defaults, $foreground, $pid_file, $procid, $pid, $log_file, $fai_logpath);
my ($server_ip, $server_port, $server_timeout, $server_domain, $server_key_lifetime);
my ($client_port, $ldap_enabled, $ldap_config, $pam_config, $nss_config);
my ($root_uid, $adm_gid);
daemon_log("shutting down gosa-si-client", 1);
-# to be changed crude !!
-# system("kill `ps -C gosa-si-server -o pid=`");
+ # shtudown the client by telling the poe kernel
$global_kernel->yield('shutdown');
+ #removing the opts file
unlink ('/var/run/gosa-si/gosa-si-client.opts');
+ #removing the fifo for communication
unlink ($fai_com_fifo);
-
+
+ #removing the pid
$pid->remove or warn "Could not remove $pid_file\n";
exit(0);
sub find_servers {
# add gosa-si-server address from config file at first position of server list
- #my $server_check_cfg = Config::IniFiles->new( -file => $cfg_file );
my $server_check_cfg = Config::IniFiles->new( -file => $config );
# Parse servers string
}
}
+
sub start_daemon {
if( ! $foreground ) {
open STDIN, '+>/dev/null' or die "Can't read /dev/null: $!";
open STDOUT, '+>&STDIN' or die "Can't write to /dev/null: $!";
open STDERR, '+>&STDIN' or die "Can't write to /dev/null: $!";
- defined(my $child_pid = fork) or die "Can't fork: $!";
- exit if $child_pid;
+ defined($pid = fork) or die "Can't fork: $!";
+ exit if $pid;
setsid or die "Can't start a new session: $!";
}
return;
# read and set config parameters
&read_configfile($config, %cfg_defaults);
-# create pid file
-&create_pid($pid, $pid_file);
-
# daemonize the program
&start_daemon($foreground);
+# create pid file
+&create_pid($pid, $pid_file);
+
# Determine root uid and adm gid, used for creating log files
&get_perms_admin($root_uid, $adm_gid);