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 ;-)