On Wed, Jun 02, 2010 at 03:19:08PM +0200, Lars Marowsky-Bree wrote:
> On 2010-06-02T14:51:25, Lars Ellenberg <[email protected]> wrote:
> 
> > I'd not put it into the RA.
> > I'd write a wrapper around whatever process is supposed to run.
> > maybe a shell script, or a shell function.
> > 
> > somthing like that:
> > 
> > call_crm_resource-F_on_process_exit.sh
> > #!/bin/sh
> > # takes OCF_RESOURCE_INSTANCE from environment,
> > # would need to check that that exists
> > "$@"
> > crm_resource -F -r $OCF_RESOURCE_INSTANCE
> 
> The problem here is if the process either background itself or forks
> children that need to be monitored independently. The wrapper will fail
> for anything that doesn't remain in the foreground.

Most auto-backgrounding thingies also have a "foreground" mode.

BTW, the RA cannot register the pid of the background process either,
as it only knows the pid of the process before it backgrounded itself.

Unless that thing writes a pid file.
Oh, and beware of pid recycling...
That may happen very fast sometimes.

> (While we're at it, the process watcher could probably also check
> whether the pid has gone zombie on us ...)

It can only go zombie, if its parent still exists,
but "forgets" to do the waitpid.
As the shell wrapper waits for its child,
there won't be a zombie.
Am I misunderstanding something?

-- 
: Lars Ellenberg
: LINBIT | Your Way to High Availability
: DRBD/HA support and consulting http://www.linbit.com

DRBD® and LINBIT® are registered trademarks of LINBIT, Austria.
_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to