Before my daemon is stopped I need to do call another program.
My first try was to use ExecStopPre
similar to ExecStartPre
but according to https://bugs.freedesktop.org/show_bug.cgi?id=73177 this is not supported and I should use "multiple ExecStop".
Anyone got an example for this? How should i kill the daemon from ExecStop
?
Systemd services can be modified using the systemctl edit command. This creates an override file /etc/systemd/system/httpd. service.
The database server requires a Services file, which contains information about the known services on your network. The Services file is typically located in %windir%\System32\drivers\etc\services.
The ExecStop setting is optional and is used to communicate with the service for a clean termination. The process specified by ExecStop will run in case the service crashes.
You put multiple lines with ExecStop (from a node.js service): e.g.
[Service]
ExecStartPre=/usr/local/bin/npm run build
ExecStartPre=-/bin/rm local.sock
ExecStart=/usr/local/bin/npm --parseable start
ExecStop=/usr/local/bin/npm --parseable stop
ExecStop=-/bin/rm local.sock
RestartSec=300
Restart=always
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=nodejs
User=nobody
Group=nobody
Environment=NODE_ENV=dev
Environment=PORT=3000
WorkingDirectory=/var/www/nodejs/quaff
UMask=007
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With