在自定义 tomcat 成系统服务时候出现了问题,
```
sudo service tomcat-ad status
● tomcat-ad.service - Ad Service
Loaded: loaded (/etc/systemd/system/tomcat-ad.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2020-01-07 15:27:00 CST; 1s ago
Process: 23931 ExecStop=/bin/kill -s QUIT $MAINPID (code=exited, status=0/SUCCESS)
Process: 23991 ExecStart=/home/hadoop/ad-server/apache-tomcat-7.0.82/bin/
startup.sh (code=exited, status=0/SUCCESS)
Main PID: 24000 (java)
Tasks: 28
Memory: 375.8M
CPU: 4.753s
CGroup: /system.slice/tomcat-ad.service
└─24000 /usr/java/jdk1.8.0_151/bin/java -Djava.util.logging.config.file=/home/hadoop/ad-server/apache-tomcat-7.0.82/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
Jan 07 15:27:00 node3 systemd[1]: Starting Ad Service...
Jan 07 15:27:00 node3
startup.sh[23991]: Tomcat started.
Jan 07 15:27:00 node3 systemd[1]: Started Ad Service.
```
status 查看是 active 但是我 stop 时候时候显示是 failed
```
tomcat-ad.service - Ad Service
Loaded: loaded (/etc/systemd/system/tomcat-ad.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2020-01-07 15:26:48 CST; 3s ago
Process: 23931 ExecStop=/bin/kill -s QUIT $MAINPID (code=exited, status=0/SUCCESS)
Process: 23826 ExecStart=/home/hadoop/ad-server/apache-tomcat-7.0.82/bin/
startup.sh (code=exited, status=0/SUCCESS)
Main PID: 23835 (code=exited, status=143)
Jan 07 15:25:59 node3 systemd[1]: Starting Ad Service...
Jan 07 15:25:59 node3
startup.sh[23826]: Tomcat started.
Jan 07 15:25:59 node3 systemd[1]: Started Ad Service.
Jan 07 15:26:47 node3 systemd[1]: Stopping Ad Service...
Jan 07 15:26:48 node3 systemd[1]: tomcat-ad.service: Main process exited, code=exited, status=143/n/a
Jan 07 15:26:48 node3 systemd[1]: Stopped Ad Service.
Jan 07 15:26:48 node3 systemd[1]: tomcat-ad.service: Unit entered failed state.
Jan 07 15:26:48 node3 systemd[1]: tomcat-ad.service: Failed with result 'exit-code'.
```
为什么是 return status 143 呢?
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
https://www.v2ex.com/t/635831
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.