diff --git a/ldap-server/lang/en b/ldap-server/lang/en index 16d53d93d..2a496869b 100644 --- a/ldap-server/lang/en +++ b/ldap-server/lang/en @@ -214,6 +214,7 @@ apply_ecannot=You are not allowed to apply the configuration stop_err=Failed to stop LDAP server stop_ecmd=$1 failed : $2 stop_egone=No longer running! +stop_egone2=Running but PID is unknown! stop_ekill=Kill process failed : $1 stop_ecannot=You are not allowed to stop the LDAP server diff --git a/ldap-server/ldap-server-lib.pl b/ldap-server/ldap-server-lib.pl index a7d18c099..28ec90c86 100755 --- a/ldap-server/ldap-server-lib.pl +++ b/ldap-server/ldap-server-lib.pl @@ -526,6 +526,7 @@ if ($config{'stop_cmd'}) { else { local $pid = &is_ldap_server_running(); $pid || return $text{'stop_egone'}; + $pid > 1 || return $text{'stop_egone2'}; return kill('TERM', $pid) ? undef : &text('stop_ekill', $!); } } @@ -564,6 +565,9 @@ else { # Returns the process ID of the running LDAP server, or undef sub is_ldap_server_running { +&foreign_require("init"); +my $iname = $config{'init_name'} || $module_name; +return 1 if (&init::status_action($iname) == 1); local $pidfile = &get_ldap_server_pidfile(); if ($pidfile) { return &check_pid_file($pidfile);