I have a question regarding the configuration of a systemd service.
The service application is an application the controls a machine. Within the application the SIGINT, SIGTERM, SIGQUIT and SIGHUP are captured. When the machine is "RUNNING", these signals are ignored and the application is not exited. If the machine is in "STOPPED" mode, the controlling application is exited.
We want to boot this application together with Linux, so we added the application as a systemd service.
We have the following configuration so far:
[Unit] Description=Machine control service After=network.target [Service] Type=simple User=simplemachine Group=simplemachine CPUSchedulingPolicy=other LimitRTPRIO=80 LimitRTTIME=infinity WorkingDirectory=/opt/simplemachine/bin/ ExecStart=/opt/simplemachine/bin/simplemachine KillMode=none Restart=always RestartSec=10 [Install] WantedBy=multi-user.target
Now I have the following questions. When I perform:
sudo systemctl stop machine.service
I would like systemctl to send a SIGTERM, this way the application is only stopped when it is allowed to stopped. Also when the application does not stop. It would be nice that systemctl does not kill the process, but for example returns some kind of fault or timeout code meaning that it may not stop the process.
How can I achieve this with the new systemd system?