On 2014/06/25 13:04, Stuart Henderson wrote: > On 2014/06/24 20:56, b...@tilderoot.com wrote: > > The nsd rc script returns an exit code other than 1 when nsd is > > not running. A problem arises when using a configuration management > > (CM) system such as ansible to control system services. With this > > non-standard exit code, the CM system cannot determine if the service > > is running or not. The nsd rc script runs 'nsd-control status', which > > documentation states will exit 3 when nsd is not running. I'd argue that > > the rc script should catch that, and instead exit 1. > > If it was just for a CM system I'd argue that it should probably be > more flexible, but it also goes against the documentation in rc.subr(8), > so I think this should be fixed. > > I'll commit this soon unless there are any objections. > > > Index: nsd > > =================================================================== > > RCS file: /cvs/src/etc/rc.d/nsd,v > > retrieving revision 1.7 > > diff -u -p -u -r1.7 nsd > > --- nsd 7 May 2014 02:46:05 -0000 1.7 > > +++ nsd 25 Jun 2014 03:53:50 -0000 > > @ -25,6 +25,12 @@ rc_start() { > > > > rc_check() { > > ${daemon} ${daemon_flags} status > > + ret=$? > > + if [[ $ret != 0 ]]; then > > + return 1 > > + else > > + return 0 > > + fi > > } > > > > rc_reload() { > > >
Actually, no need for the if; this is simpler: Index: nsd =================================================================== RCS file: /cvs/src/etc/rc.d/nsd,v retrieving revision 1.7 diff -u -p -r1.7 nsd --- nsd 7 May 2014 02:46:05 -0000 1.7 +++ nsd 25 Jun 2014 12:06:29 -0000 @@ -24,7 +24,7 @@ rc_start() { } rc_check() { - ${daemon} ${daemon_flags} status + ${daemon} ${daemon_flags} status || exit 1 } rc_reload() {