public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Max Arnold <lwarxx@gmail.com>
To: gentoo-dev@lists.gentoo.org
Subject: [gentoo-dev] start-stop-daemon and python-wrapper
Date: Tue, 15 Dec 2009 15:54:53 +0700	[thread overview]
Message-ID: <20091215085453.GA7941@bbone> (raw)

Hello all.

I've got something similar to this: http://archives.gentoo.org/gentoo-dev/msg_54ec9c3d4c15c3f52e4c71fef5d42633.xml
I have custom python script which should run in background. It spawns several threads but does
not daemonizes itself, so I use following init.d script ($MYSCRIPT writes its own pid upon
startup and removes it when stopped, also it refuses to start if pid already exists):

start () {
	/sbin/start-stop-daemon --start --pidfile $MYSCRIPT_PID \
		--chdir $MYSCRIPT_HOME --background --exec $MYSCRIPT --startas $MYSCRIPT
	eend $?
}

stop () {
	/sbin/start-stop-daemon --stop --pidfile $MYSCRIPT_PID --signal INT
	result=$?
	rm -f $MYSCRIPT_PID
	eend $result
}

Now I noticed it does not work reliably, because shutdown takes some time and start-stop-daemon
does not wait for this. I started to experiment with --exec and other options and now can't find
correct way to handle process name, because it starts with /usr/bin/python2.6 and I don't want
to hardcode it in ebuild or init script. Also I do not want to introduce fixed delay because
actual shutdown time varies a lot.

Initially my script has "/usr/bin/env python" shebang line.  When I checked actual installed
file, it contained "/usr/bin/python2.6".  Who is responsible for this modification (eclass,
distutils or something else)?  Why not "/usr/bin/env python2.6"?  How this relates to python-
wrapper linked to /usr/bin/python and what it is supposed to do?  Is /usr/bin/python2.6 a real
python binary or another wrapper? What is the recommended way to write ebuilds and init scripts
in such cases?  Any documentation or examples?  I've found several discussions on bugzilla but
still can't get the whole picture about this python wrapper thing and recommended ways to use.

My custom ebuild inherits eutils/distutils and contains >=dev-lang/python-2.5 in DEPEND.

Thanks!



             reply	other threads:[~2009-12-15 10:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-15  8:54 Max Arnold [this message]
2009-12-18 20:16 ` [gentoo-dev] start-stop-daemon and python-wrapper Brian Harring
2009-12-18 22:01   ` James Rowe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091215085453.GA7941@bbone \
    --to=lwarxx@gmail.com \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox