Search code examples
batch-filedeploymentjboss7.xizpack

Check whether the ear got deployed in jboss using batch file


I have created a installer which creates a shortcut which servers the purpose of starting the jboss service and launching the application via a browser.

For achieving this i deployed Jboss 7.1 as a service and have a batch file which starts the jboss service using command sc start SERVICE_NAME and the next activity it should do launch the application by opening a internet explorer with a specified url. like e.g

*START iexplore urloftheapplication *

The problem is that i only want o launch ie with the url only when the application(.ear) gets deployed not when the jboss service is started or in other words when in the JBOSS deployments folder has a .deployed file indicating that the application is well deployed

How to achieve this? Any help would be helpful.


Solution

  • To be included in your batch deployment process. Adapt as needed

        ...
        set "JBOSS_DEPLOYMENT_DIR=C:\Wherever\JBOSS\Deployment\Is"
        set "deployedAPP=nameOfAppFile"
    
    :checkIfDeployed
        rem test for existence of file
        if exist "%JBOSS_DEPLOYMENT_DIR%\%deployedAPP%.deployed" (
            goto appDeployed
        )
    
        if exist "%JBOSS_DEPLOYMENT_DIR%\%deployedAPP%.failed" (
            goto deployFailed
        )
    
        rem file does not exist, wait for 5 seconds
        ping -n 6 -w 1 localhost >nul
    
        rem test again
        goto checkIfDeployed
    
    :appDeployed
        rem here, the app is deployed
        ...
        ...
        goto endDeploy
    
    :deployFailed
        rem here, the deployment failed
        ...
        ...
        goto endDeploy
    
    
    :endDeploy
        rem ....