본문 바로가기

OS (Operating System)/Linux

리눅스 (Linux) 리눅스 톰캣 서비스 등록, Tomcat Service Ubuntu

728x90
ssh -p 22 test@192.168.100.200

ssh로 우분투 접속

 

sudo vi /etc/systemd/system/tomcat.service

service 파일 생성

 

[Unit]
Description=tomcat service
Requires=network.target
After=network.target

[Service]
Type=forking
#PIDFile=
Environment="JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64"
User=root
Group=root
ExecStart=/home/test/apache-tomcat/bin/startup.sh
ExecStop=/home/test/apache-tomcat/bin/shutdown.sh
Restart=on-abnormal

[Install]
WantedBy=multi-user.target

경로설정, 저장

 

//리로드
systemctl daemon-reload
//service 활성화
systemctl enable tomcat
//server실행
systemctl start tomcat
//server 상태확인
systemctl status tomcat

active running 성공

 

 

 

추가명령어

//server종료
systemctl stop tomcat
//service 비활성화
systemctl disable tomcat
728x90