[Pkg-sysvinit-devel] Bug#668332: Info received (Bug#643337: dpkg: start-stop-daemon can't handle script daemon)
Jérôme
jerome at jolimont.fr
Mon Apr 8 10:48:00 UTC 2013
Update.
I removed the --name argument, and I use following values:
NAME=script_name
DAEMON=path_to_script/$NAME
DAEMON_ARGS="--args"
do_start()
{
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
start-stop-daemon --start --quiet --background --make-pidfile
--chuid=$DAEMONUSER --pidfile $PIDFILE --startas $DAEMON --test >
/dev/null \
|| return 1
start-stop-daemon --start --quiet --background --make-pidfile
--chuid=$DAEMONUSER --pidfile $PIDFILE --startas $DAEMON -- \
$DAEMON_ARGS \
|| return 2
[...]
do_stop()
{
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
start-stop-daemon --stop --quiet --retry=INT/30/KILL/5
--pidfile $PIDFILE
[...]
Now, I get expected behaviour. That is, the script won't launch two
instances of the application, and I have an explicit status message.
Yet, the name of the executable is not checked, which means that if it
dies somehow, and a new process gets its PID, the script will stop the
new process.
I suppose a nicer way would be to get s-s-d to write the name of the
script itself ($NAME) in /proc/PID/stat, instead of the name of the
interpreter ("python"). I couldn't achieve this.
Am I misunderstanding something ?
--
Jérôme
More information about the Pkg-sysvinit-devel
mailing list