./categories/os
Ubuntu Tomcat 부팅 자동 실행
Ubuntu 부팅 시 Tomcat (init.d)
sudo vim /etc/init.d/tomcat
#!/bin/bash
### BEGIN INIT INFO
# Provides: tomcat
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: auto start Tomcat
### END INIT INFO
TOMCAT_HOME=/usr/local/apache-tomcat
case "$1" in
start)
sh "$TOMCAT_HOME/bin/startup.sh"
;;
stop)
sh "$TOMCAT_HOME/bin/shutdown.sh"
;;
restart)
sh "$TOMCAT_HOME/bin/shutdown.sh"
sh "$TOMCAT_HOME/bin/startup.sh"
;;
esac
exit 0
sudo chmod 755 /etc/init.d/tomcat
sudo update-rc.d tomcat defaults
sudo service tomcat restart
최신 Ubuntu는 systemd unit 권장.
관련 링크: https://minddong.tistory.com/21
./comments