Context
A SIGINT (sent to it with the appropriate kill command or ctrl-c) should do it
@cassie
I have also added KillSignal=SIGINT to my services
by default KillMode is set to control-group and control-group first terminates processes with SIGTERMYou can set KillSignal=SIGINT which overrides that default
@Tyga
systemd.kill — Process killing procedure configuration
https://www.freedesktop.org/software/systemd/man/latest/systemd.kill.html
Question
Does this work for people running the release_autorun.sh via their service file?
And if not what is the solution?
Service file example
[Unit]
Description=Ceremony Client Go App Service
[Service]
Type=simple
Restart=always
RestartSec=5s
WorkingDirectory=/root/ceremonyclient/node
ExecStart=/root/ceremonyclient/node/release_autorun.sh
[Install]
WantedBy=multi-user.target
Service file with kill (suggestion by Claude AI)
[Unit]
Description=Ceremony Client Go App Service
[Service]
Type=simple
Restart=always
RestartSec=5s
WorkingDirectory=/root/ceremonyclient/node
ExecStart=/bin/bash -c '/root/ceremonyclient/node/release_autorun.sh & wait $!'
ExecStop=/bin/kill -SIGINT $MAINPID
KillMode=mixed
KillSignal=SIGTERM
TimeoutStopSec=70s
[Install]
WantedBy=multi-user.target
The above service file:
- Runs the script in a way that systemd can track the main process.
- Explicitly sends SIGINT when stopping, which should be caught by the bash process and propagated to the node process.
- Uses
KillMode=mixed
to ensure that if the main process doesn’t exit, systemd will still attempt to kill all processes in the control group.- Provides a 70-second timeout for the stop process.
I have no clue if the above could work. Bigger brains needed. Thanks