운영 체제가 다시 시작될 때 ExecStopPost의 명령이 실행되도록 서비스를 올바르게 구성하는 방법입니다.
my.service
[Unit]
Description=my.service
After=syslog.target
After=network.target
After=my-service.mount
ConditionFileNotEmpty=/opt/myService/myService.java
[Service]
User=UserName
Group=UserGroup
WorkingDirectory=/opt/myService
OOMScoreAdjust=-100
Type=forking
ExecStart=/usr/bin/java ./myService.java start
TimeoutStartSec=90
ExecStopPost=/usr/bin/java ./myService.java stop
TimeoutStopSec=30
Restart=on-failure
RestartSec=60
[Install]
WantedBy=multi-user.target