[Pkg-sysvinit-devel] Bug#668332: Bug#643337: dpkg: start-stop-daemon can't handle script daemon
Jérôme
jerome at jolimont.fr
Fri Apr 5 12:30:39 UTC 2013
Hi.
> No, this all looks right, --name should usually be used on interpreted
> scripts and --exec otherwise.
Using --name might not always be possible:
> start-stop-daemon: warning: this system is not able to track process names
> longer than 15 characters, please use --exec instead of --name.
Now, even with a shorter name, I can't get it to work.
> For the record, I replaced the above by something like this:
>
> start-stop-daemon --start --quiet --pidfile $PIDFILE --startas $DAEMON \
> --name $NAME --test > /dev/null \
> || return 1
> start-stop-daemon --start --quiet --pidfile $PIDFILE --startas $DAEMON \
> --name $NAME -- \
> $DAEMON_ARGS \
> || return 2
Here's what I have in my init script:
start-stop-daemon --start --quiet --background --make-pidfile
--chuid=$DAEMONUSER --pidfile $PIDFILE --startas $DAEMON --name $NAME
--test > /dev/null \
|| return 1
start-stop-daemon --start --quiet --background --make-pidfile
--chuid=$DAEMONUSER --pidfile $PIDFILE --startas $DAEMON --name NAME --
\
$DAEMON_ARGS \
|| return 2
I'm using:
NAME=python_script
DAEMON=path_to_script/$NAME
DAEMON_ARGS="--args"
When using start option, the pid file is created, but the name in
/proc/pid/stat is python, therefore, when calling start again, a new
instance is created.
If I do it this way:
NAME=python
DAEMON=/usr/bin/python
DAEMON_ARGS="path_to_script/python_script --args"
s-s-d will only allow one instance. Yet, it does not look so nice. And
the status command outputs
[ ok ] python is running.
Is this the recommended way ? Or did I miss something ?
By the way, while investigating this, I stumbled across this thread:
http://dev.gentoo.org/~vapier/openrc/projects/openrc/ticket/164.html
where there is talk about daemonizing a perl script. Apparently, s-s-d
was modified to add an --interpreted flag. Not sure this is relevant.
--
Jérôme
More information about the Pkg-sysvinit-devel
mailing list