How to set tomcat auto start

Dear Community,

After installing DHIS2 Server, i would like that tomcat to start automatically and restart when the instance goes down. Can someone has an idea on how to do this

Amza

Starting DHIS2 at server startup
Create init scripts:
sudo nano tomcat

Enter the following lines:

#!/bin/sh
tomcat init script

HOME=/home/dhis/tomcat-dhis/bin

case $1 in
start)
sudo -u dhis ${HOME}/startup.sh
;;
stop)
sudo -u dhis ${HOME}/shutdown.sh
;;
restart)
sudo -u dhis ${HOME}/shutdown.sh
sleep 5
sudo -u dhis ${HOME}/startup.sh
;;
esac
exit 0

Move the script to the init script directory and make it executable by invoking:
sudo mv tomcat /etc/init.d
sudo chmod +x /etc/init.d/tomcat

Next, make sure the tomcat init script will be invoked during system startup and shutdown:
sudo /usr/sbin/update-rc.d -f tomcat defaults 81

Check this link for more details DHIS2: District Health Information System

Hi, @Kenyuri
I have installed DHIS2 2.34.4 on a Windows server operating system.
How to make Tomcat automatically startup?
Thank you

You can follow the link to auto start applications in windows.refer the link Change which apps run automatically at startup in Windows - Microsoft Support .Place your location /bin/startup.bat

2 Likes

Thank you for your support

1 Like