I'm using an instance of Amazon Linux (Amazon Linux AMI 2016.03.3).
I want to run Tomcat as a service.
I want to set up tomcat.service and register tomcat in the service.
/etc/systemd/system/tomcat.service
I tried to register the service like a regular centos 7, but I don't have a systemd folder, is there any other way?
aws tomcat
It seems to work with the previous init.d script, not the systemmd used from CentOS 7.
Use the following link to create an init script for starting tomcat.
[1] https://gist.github.com/miglen/5590986
[2] https://gist.github.com/valotas/1000094
Save the location of the script as tomcat
in /etc/init.d/
.
After that, you can give the following command and sign up for the startup service.
chkconfig --add tomcat
chkconfig --list tomcat
If you give the command as shown above, you can see at what run level it starts at.
To make it work at a specific run level, you can give the command as follows:
chkconfig --level 35 on
The above is to start at run levels 3 and 5. If you use off instead of on, it doesn't start at that run level.
© 2025 OneMinuteCode. All rights reserved.