Gentoo Archives: gentoo-dev

From: "Steven J. Long" <slong@××××××××××××××××××.uk>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] Re: OpenRC supporting systemd units
Date: Fri, 10 May 2013 04:18:10
Message-Id: 20130510044537.GA2776@rathaus.eclipse.co.uk
In Reply to: Re: [gentoo-dev] OpenRC supporting systemd units by Ambroz Bizjak
1 Ambroz Bizjak wrote:
2 > Rich Freeman wrote:
3 > > Init.d scripts are programs - they could probably do just about anything.
4 >
5 > They couldn't monitor a process and restart it when it crashes, as
6 > specified by the restart options in the unit file. That is, without
7 > significant modifications in the way OpenRC works, such as adding a
8 > monitoring process, or hacks such as launching a daemon that monitor
9 > that process specifically.
10
11 Actually a shell script can do that very easily, given a daemon that either
12 doesn't self-background, or can be given a switch to tell it not to "daemonize",
13 which reasonably modern services should support. See Q: 3.2 here:
14 http://mywiki.wooledge.org/ProcessManagement (the linked "Wrapper Script" page
15 is interesting as well.)
16
17 That's assuming you don't want a simple respawn in inittab. Another common
18 loop is:
19
20 until somesrv -f "$blah"; do
21 e=$?
22 # stuff on abnormal termination, check situation etc
23 all_ok || exit # exits $?, or use $e or 1..
24 done
25 # svc terminated normally
26 :
27 --
28 #friendly-coders -- We're friendly, but we're not /that/ friendly ;-)