def start_services(self):
        # Detect sevice path and apache service name
        service_path = '/sbin/service'
        apache_service_name = 'httpd'
        if self.os_type in ['centos', 'redhat', 'fedora'] and self.os_initdaemon == 'systemd':
           service_path = '/usr/bin/systemctl'
           apache_service_name = 'httpd'
        elif self.os_type in ['debian', 'ubuntu']:
           service_path = '/usr/sbin/service'
           apache_service_name = 'apache2'

        # Apache HTTPD
        if self.os_type in ['centos', 'redhat', 'fedora'] and self.os_initdaemon == 'systemd':
           self.run([service_path, 'enable', apache_service_name])
           self.run([service_path, 'start', apache_service_name])
        else:
           self.run([service_path, apache_service_name, 'start'])

        # Memcached
        if self.os_type in ['centos', 'redhat', 'fedora'] and self.os_initdaemon == 'systemd':
           self.run([service_path, 'start', 'memcached.service'])
        else:
           self.run([service_path, 'memcached', 'start'])

        # Apache Tomcat
        try:
            # Giving LDAP a few seconds to load the data...
            i = 0
            wait_time = 5
            while i < wait_time:
                time.sleep(1)
                print ".",
                i = i + 1
            if self.os_type in ['centos', 'redhat', 'fedora'] and self.os_initdaemon == 'systemd':
               self.run([service_path, 'enable', 'tomcat'])
               self.run([service_path, 'start', 'tomcat'])
            else:
               self.run([service_path, 'tomcat', 'start'])
        except:
            self.logIt("Error starting tomcat")
            self.logIt(traceback.format_exc(), True)
dataset/ETHPy150Open GluuFederation/community-edition-setup/setup.py/Setup.start_services/original