Re: problem with debconf and start-stop-daemon
On 23-Mar-02, 16:32 (CST), Brian May <email@example.com> wrote:
> Maybe I don't know what I am talking about <grin/>, but would it be
> possible to lookup the inode of the executable when starting it,
> and then look it up before killing it?
That's what --exec does, I think. The problem is that when you
upgrade, the inode for the executable changes, which is what --exec is
complaining about - that the inode of the executable of the process
you're trying to kill doesn't match the inode of the executable that you
claim is running.
> hmmmm.... not sure if it is possible to lookup the inode number of a
> process running from a deleted executable, but anyway, just an idea...
Look in /proc/<pid>/maps -- the last number before the filename is the
inode. If you rm the file, then it shows up with "(deleted)" after the
file name (yep, steve's experimenting.) I don't know if that's what
start-stop-daemon does, but the info is there.
> I think the inode number should stay the same for the duration the
> process runs.
It definetly does. When you unlink() a file, it just removes an entry
for that inode from the filesystem. If it's the last entry, then you
can't access it via open(), etc., but the inode doesn't actually get
freed until all the procs that currently have it open close it.
Which means you can do the following (as Wichert points out in another note):
# Create another entry for this inode
ln /usr/sbin/foo /usr/sbin/foo.saveforstop
start-stop-daemon --stop --exec /usr/sbin/foo.saveforstop
start-stop-daemon --start --exec /usr/sbin/foo
(wrapped with appropriate calls to invoke-rc.d to determine if you
should be stopping/starting it, of course.)
To UNSUBSCRIBE, email to firstname.lastname@example.org
with a subject of "unsubscribe". Trouble? Contact email@example.com