def __init__(self, module):
        '''
        Constructor
        '''
        guid = generateGUID()
        log.info("Unique ActionBundle execution ID generated: " + guid)

      #  appServer = ApplicationServer(module, scriptGlobals.appsrvProperties)
        pid = getProcessPIDByPathAndIdentifier(module.targetDeploymentPath, module.subModule.processIdentifier)

        bin_path=module.targetDeploymentPath  + "/"  + module.subModule.name +  "/bin/"

        if pid:
            log.info("\n\nAlready existing process running from path '" + module.targetDeploymentPath + "' with pid '" + pid + "'.\n")
            log.info("\n\Proceeding with Killing the Server")
            # Kill process using pid
            killProcess(pid)

        # Delete all cached directories
        log.info("Proceeding to delete nohup file")
        try:
            deleteDirOrFile(bin_path + "nohup.out")
        except OSError: # If directory doesn't exist ignore the raised error
                pass

        # Change directory to run the binary from inside the binpath
        pwd = os.getcwd()
        os.chdir(bin_path)
        ChangePathPermissions(bin_path + "start.sh", 0744)
        runProcess("nohup ./start.sh")
        os.chdir(pwd)

        # Construct the email notification
        emailSender = readPropertyFromPropertiesFileWithFallback("emailNotificationSenderAddress", scriptGlobals.scriptVarSectionName, lib.OptParser.options.envprops, scriptGlobals.emailNotificationSenderAddress)
        emailRecipients = module.emailNotificationRecipientList
        emailSubject = "Server START: " + module.subModule.name + "@"+ getCurrentHostname() + " (" + module.friendlyServerName + ")"
        emailText = startApplicationServerNotificationTemplate(module.name, getCurrentHostname(), guid)

        # Email all required parties
        SendEmail(emailSender,
                      emailRecipients,
                      emailSubject,
                      emailText,
                      scriptGlobals.smtpHost,
                      scriptGlobals.smtpPort)
    def __init__(self, module):
        '''
        Constructor
        '''
        guid = generateGUID()
        log.info("Unique ActionBundle execution ID generated: " + guid)
                      
        appServer = ApplicationServer(module, scriptGlobals.appsrvProperties)
        pid = getProcessPIDByPathAndIdentifier(module.targetDeploymentPath, appServer.processIdentifier)
        
        if pid: 
            log.error("Already existing process running from path '" + module.targetDeploymentPath + "' with pid '" + pid + "'.")
        else:
            # Delete all cached directories
            log.info("Proceeding to delete all cached folders")
            try:
                for i in appServer.relativeCacheFolders:
                    deleteDirOrFile(module.targetDeploymentPath + scriptGlobals.osDirSeparator + i)
            except OSError: # If directory doesn't exist ignore the raised error
                pass
            
            # Change directory to run the binary from inside the binpath
            pwd = os.getcwd()
            os.chdir(module.targetDeploymentPath + appServer.binPath)
            runProcess("." + scriptGlobals.osDirSeparator + appServer.startCommand)
            os.chdir(pwd)

            # Construct the email notification
            emailSender = readPropertyFromPropertiesFileWithFallback("emailNotificationSenderAddress", scriptGlobals.scriptVarSectionName, lib.OptParser.options.envprops, scriptGlobals.emailNotificationSenderAddress)            
            emailRecipients = module.emailNotificationRecipientList
            emailSubject = "Server START: " + module.name + "@"+ getCurrentHostname() + " (" + module.friendlyServerName + ")"
            emailText = startApplicationServerNotificationTemplate(module.name, getCurrentHostname(), guid) 
            
            # Email all required parties
            SendEmail(emailSender, 
                      emailRecipients,
                      emailSubject, 
                      emailText, 
                      scriptGlobals.smtpHost, 
                      scriptGlobals.smtpPort)