7 Replies Latest reply on Apr 11, 2011 4:45 PM by Peter Johnson

    Delete tmp folder on redeploy

    Bonnie Kenison Newbie

      In JBoss 4.2.3, when JBoss was stopped and restarted, the JBOSS_HOME/server/default/tmp directory's contents were deleted and the application was redeployed.

       

      Recently, I switched to JBoss 5.1.0 and this behavior is no longer happening.  On each stop and restart, my application's ear is expanded in the tmp directory, but the last deployment is still there.  After several stops and starts, this directory is getting filled up with old stuff.  Is there a setting somewhere that I need to set to cause this directory to get cleaned up?

       

      Thanks

        • 1. Re: Delete tmp folder on redeploy
          jaikiran pai Master

          When you say stop and restart, do you mean stopping and starting the server or do you mean redeploying the application? Which Operating system are you on and which exact version/vendor of Java?

          • 2. Re: Delete tmp folder on redeploy
            Wolf-Dieter Fink Master

            With JBoss 4.3.0(EAP) the tmp directory was not deleted after stopping.

            We decide to delete tmp and work before starting because sometimes we have startup problems which disapear after removing this directories.

            • 3. Re: Delete tmp folder on redeploy
              jaikiran pai Master

              Wolf-Dieter Fink wrote:

               

              With JBoss 4.3.0(EAP) the tmp directory was not deleted after stopping.

              I would have expected the tmp to be deleted and recreated on every server restart.

               

              Wolf-Dieter Fink wrote:

               

               

              We decide to delete tmp and work

              The "work" directory is a bit different. It by default is not recreated every restart. There's a configuration in one of the xml files which controls the work directory recreation.

              • 4. Re: Delete tmp folder on redeploy
                Bonnie Kenison Newbie

                I am running on Windows Server 2008 and have JBoss 5.1.0.GA running as a Windows service.  By stopping/starting, I am stopping the service and restarting the service.  Stopping the service does a complete stop of JBoss.  When restarting the service, JBoss is started and the ear is re-deployed.  The prior contents of the tmp directory remain and additional files are created. 

                 

                In JBoss 4.2.3.GA, this did not happen.  In 4.2.3, the prior contents of the tmp directory were removed and only the newly deployed files exist once JBoss has completely started.  I have seen reference to the configuration to delete the work directory and wondered if there was a similar control for the tmp directory.

                • 5. Re: Delete tmp folder on redeploy
                  Peter Johnson Master

                  If I recall correctly for another discussion, you are using service.bat for run as a service. You can add a 'del' into either run.bat or even service.bat (as part of either start or stop) to remove the tmp directory.

                  • 6. Delete tmp folder on redeploy
                    Shaun Smith Newbie

                    Just wanted to comment on this, I achieved this by adding the following lines to the top of the run.bat:

                     

                    rem Remove tmp folder on startup

                    set TMP_FOLDER ..\server\default\tmp

                    rmdir /s /q %TMP_FOLDER%

                     

                    Note: This path is relative to the \bin folder and you might need to rename the path to match your instance.

                    • 7. Delete tmp folder on redeploy
                      Peter Johnson Master

                      Change the second line to:

                       

                      set TMP_FOLDER=%JBOSS_HOME%\server\default\tmp

                       

                      Note that the first thing that run.bat does is set JBOSS_HOME (if it is not already set, and I recommend never to set it).