自定义systemctl服务
systemctl
Systemd: 系统守护(daemon)
文件后缀.service 用于定义系统服务 [.target,.device,.mount,.socket]
服务目录 /usr/lib/systemd/system/
命令
systemctl status name.service
systemctl start name.service
systemctl stop name.service
systemctl restart name.service
systemctl daemon-reload
添加tomcat服务
* vi catalina.sh; 添加 export JAVA_HOME
* touch tomcat.service
* cp tomcat.service /usr/lib/systemd/system/tomcat.service
## vi tomcat.service
[Unit]
Description=ecsweb tomcat
After=ecsweb.service
[Service]
Type=forking
User=root
Group=root
ExecStart=/usr/local/deploy/datafs/tomcat/apache-tomcat-9.0.37/bin/startup.sh
ExecReload=
ExecStop=/usr/local/tomcat/bin/shutdown.sh
SuccessExitStatus=143
[Install]
WantedBy=multi-user.target
如果觉得文章对您有用,请点下推荐。您的支持将鼓励我继续创作!