Automatically clean JBoss tmp directory
August 15, 2013 10 Comments
I have been poking about JBoss lately trying to get messaging working and I had a look in the
%JBOSS_HOME%/server/lc_turnkey/tmp directory. As you would imagine, it was chock full of temporary files (no surprise there). What I didn’t expect was how many files! So after a quick email to Adobe Support to confirm I wasn’t going to upset anything Livecycle related, I shut down JBoss and decided to clean the files out. Sometime into the delete, I got bored and lost count at 82,000 files and something like 6GB of space!
JBoss EAP 5.1.0
I had a quick Google around and it took me to a post on the JBoss Community Forum about deleting out files on a JBoss redeploy. Another user mentions that the
tmp directory is never purged on restart or starting and stopping JBoss as it was in previous versions. The recommendation was to edit the
run.bat file to do this every time the server is started.
The suggestion was to delete the files before JBoss starts up in the
run.bat file. This example is for JBoss on Windows, but its pretty easy to adapt for Linux (just edit the
run.sh file instead)
Below is the excerpt from my
C:\Adobe\Adobe LiveCycle ES4\jboss\bin\run.bat
pushd %DIRNAME%.. if "x%JBOSS_HOME%" == "x" ( set "JBOSS_HOME=%CD%" ) popd rem Remove tmp folder on startup set TMP_FOLDER=%JBOSS_HOME%\server\lc_turnkey\tmp rmdir "%TMP_FOLDER%" /s /q set DIRNAME= if "%OS%" == "Windows_NT" ( set "PROGNAME=%~nx0%" ) else ( set "PROGNAME=run.bat" )