Directory ApacheDS
  1. Directory ApacheDS
  2. DIRSERVER-1835

ApacheDS not able to restart/start when the process shown in apacheds-default.pid is not running

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.0.0-M11
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
      Linux CentOS

      Description

      I have a default instance of ApacheDS 2.0.0.M11.

      I could not restart the apacheDS service using

      /etc/init.d/apacheds-2.0.0-M11-default restart or /etc/init.d/apacheds-2.0.0-M11-default start

      after a system reboot.

      The problem is fixed by deleting the pid stored in the apacheds-default.pid file /var/lib/apacheds-2.0.0-M11/default/run/apacheds-default.pid

        Activity

        James C. Wu created issue -
        Hide
        Frank Ren added a comment -

        I need to delete the file, /var/lib/apacheds-2.0.0-M11/default/run/apacheds-default.pid, manually. It won't be deleted automatically by rebooting the operation system. It's suggested to improve the start script, so that it can detect stale pid. Here is a sample output from tomcat6 start script in similar situation.

        • Tomcat servlet engine is not running, but pid file exists.

        Upon restarting, tomcat6 just ignores the stale pid as if it doesn't exist.

        Show
        Frank Ren added a comment - I need to delete the file, /var/lib/apacheds-2.0.0-M11/default/run/apacheds-default.pid, manually. It won't be deleted automatically by rebooting the operation system. It's suggested to improve the start script, so that it can detect stale pid. Here is a sample output from tomcat6 start script in similar situation. Tomcat servlet engine is not running, but pid file exists. Upon restarting, tomcat6 just ignores the stale pid as if it doesn't exist.
        Hide
        Emmanuel Lecharny added a comment -

        I think that a restart should at least clean the pid file. I would accept that a start fail if the pid file exists (in order to protect the user against starting the server twice).

        In any case, if the server is already started, the user will get a failure as the LDAP port will already be bound, so the start will fail.

        Show
        Emmanuel Lecharny added a comment - I think that a restart should at least clean the pid file. I would accept that a start fail if the pid file exists (in order to protect the user against starting the server twice). In any case, if the server is already started, the user will get a failure as the LDAP port will already be bound, so the start will fail.
        Hide
        kh_citizen added a comment -

        Here is workaround in Python (I'm just a newbie so code might not be the best but it seems to work).

        Just make sure user running the script has appropriate sudo permissions (I've added next line to /etc/sudoers):
        username ALL=(apacheds) NOPASSWD: ALL

        #!/usr/bin/env python
        import subprocess
        import os
        import string
        
        def check_apacheds_service():
                global running,pid
                try:
                  pid=subprocess.check_output("pidof /opt/apacheds-2.0.0_M14/bin/wrapper",shell=True)
                except subprocess.CalledProcessError:
                  #write 'rm .pid' output to /dev/null
                  DEVNULL = open(os.devnull, 'wb')
                  subprocess.call(["sudo -u apacheds rm /var/lib/apacheds-2.0.0_M14/default/run/apacheds-default.pid"], stdout=DEVNULL, stderr=DEVNULL,shell=True)
                  running=False
                else:
                  print 'ApacheDS - default is running (' + string.strip(pid) + ')'
                  running=True
        
        if  __name__ == '__main__':
                check_apacheds_service()
                if not running:
                  subprocess.call(['sudo -u apacheds /etc/init.d/apacheds-2.0.0_M14-default start'],shell=True)
        
        Show
        kh_citizen added a comment - Here is workaround in Python (I'm just a newbie so code might not be the best but it seems to work). Just make sure user running the script has appropriate sudo permissions (I've added next line to /etc/sudoers): username ALL=(apacheds) NOPASSWD: ALL #!/usr/bin/env python import subprocess import os import string def check_apacheds_service(): global running,pid try : pid=subprocess.check_output( "pidof /opt/apacheds-2.0.0_M14/bin/wrapper" ,shell=True) except subprocess.CalledProcessError: #write 'rm .pid' output to /dev/ null DEVNULL = open(os.devnull, 'wb') subprocess.call([ "sudo -u apacheds rm / var /lib/apacheds-2.0.0_M14/ default /run/apacheds- default .pid" ], stdout=DEVNULL, stderr=DEVNULL,shell=True) running=False else : print 'ApacheDS - default is running (' + string.strip(pid) + ')' running=True if __name__ == '__main__': check_apacheds_service() if not running: subprocess.call(['sudo -u apacheds /etc/init.d/apacheds-2.0.0_M14- default start'],shell=True)

          People

          • Assignee:
            Unassigned
            Reporter:
            James C. Wu
          • Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:

              Development