CentOS Tomcat Service 등록하기

# cd /etc/systemd/system/
# vi [servicename].service
[Unit]
Description=tomcat 8.5
After=syslog.target network.target

[Service]
Type=forking

Environment="JAVA_HOME=/usr/local/jdk1.7.0_80"
Environment="CATALINA_HOME=/usr/local/test-tomcat"
Environment="CATALINA_BASE=/usr/local/test-tomcat"

ExecStart=/usr/local/test-tomcat/bin/startup.sh
ExecStop=/usr/local/test-tomcat/bin/shutdown.sh

User=root
Group=root

[Install]
WantedBy=multi-user.target

start

systemctl enable [servicename]
systemctl daemon-reload
systemctl start [servicename]
systemctl status [servicename]

remove service

systemctl stop [servicename]
systemctl disable [servicename]
rm /etc/systemd/system/[servicename]

rm /etc/systemd/system/[servicename] # and symlinks that might be related
rm /usr/lib/systemd/system/[servicename] 
rm /usr/lib/systemd/system/[servicename] # and symlinks that might be related

systemctl daemon-reload
systemctl reset-failed

댓글남기기