[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gentoo-dev
Subject:    [gentoo-dev] Re: OpenRC supporting systemd units
From:       "Steven J. Long" <slong () rathaus ! eclipse ! co ! uk>
Date:       2013-05-10 4:45:37
Message-ID: 20130510044537.GA2776 () rathaus ! eclipse ! co ! uk
[Download RAW message or body]

Ambroz Bizjak wrote:
> Rich Freeman wrote:
> > Init.d scripts are programs - they could probably do just about anything.
> 
> They couldn't monitor a process and restart it when it crashes, as
> specified by the restart options in the unit file. That is, without
> significant modifications in the way OpenRC works, such as adding a
> monitoring process, or hacks such as launching a daemon that monitor
> that process specifically.

Actually a shell script can do that very easily, given a daemon that either
doesn't self-background, or can be given a switch to tell it not to "daemonize",
which reasonably modern services should support. See Q: 3.2 here:
  http://mywiki.wooledge.org/ProcessManagement (the linked "Wrapper Script" page
is interesting as well.)

That's assuming you don't want a simple respawn in inittab. Another common
loop is:

until somesrv -f "$blah"; do
	e=$?
	# stuff on abnormal termination, check situation etc
	all_ok || exit # exits $?, or use $e or 1..
done
# svc terminated normally
:
-- 
#friendly-coders -- We're friendly, but we're not /that/ friendly ;-)

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic