Upstart: How to execute custom stop commands for a daemon?

I'm new to upstart. The following is the upstart configuration for the myserver daemon. It works fine, but I want to execute custom commands when I issue a "stop myserver" to completely close it. start-stop-daemon just kills the pid of the daemon.

description "My server"

start on filesystem or runlevel [2345]
stop on run level [!2345]

respawn
respawn limit 3 60

env cmd="/home/ubuntu/bin/server -- --config=server_conf.py start"

exec start-stop-daemon --start --chuid ubuntu --chdir /home/ubuntu/bin --exec $cmd
+4
source share
1 answer

This should help (although I have not tested it):

pre-stop exec /usr/bin/kill-it-with-fire

According to the example at the end of the section here he should do the trick

+2
source

Source: https://habr.com/ru/post/1536818/


All Articles