Skip to content
Advertisement

How to restart application in tomcat server

I have been looking for some solution to restart app inside tomcat server on remote linux machine but i haven’t found anything yet.

Can anyone please tell me how can i restart the application in Tomcat Server after some time interval without restarting the tomcat server on remote machine?

Can anyone help me out with the Bash Script and CRON Job?

Advertisement

Answer

. First configure your tomcat to enable access to the manager application (follow these steps)

. Then test that everything works well from a browser going to the url

 http://your_server_url:8080/manager/reload?path=/your_app_context

 [EDITED] If your version of Tomcat is 7 or above the url must be:
 http:// your_server_url:8080/manager/text/reload?path=/your_app_context 

. Do the same from command line using wget o curl

 wget -O - http://your_server_url:8080/manager/reload?path=/your_app_context

. Finally edit your crontab (run crontab -e) and set something like this:

  # run each day at 01:00
  0 1 * * * wget -O - http://your_server_url:8080/manager/reload?path=/your_app_context >/dev/null 2>&1
Advertisement