rcctl: howto set flags for disabled services?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

rcctl: howto set flags for disabled services?

Harald Dunkel-3
Hi folks,

I have to keep the flags of dnsmasq and openvpn in sync on
several hosts, even though some hosts are just a hot standby,
not running the service per default.

Problem: The "flags" in rcctl is overloaded (probably for
historical reasons): If flags is set to "NO", then the service
is not run.

Would it be possible to put this "NO" somewhere else to avoid
a conflict?


Thanx in advance
Harri

Reply | Threaded
Open this post in threaded view
|

Re: rcctl: howto set flags for disabled services?

Harald Dunkel-3
On Wed, 18 Oct 2017 10:25:52 +0200
Harald Dunkel <[hidden email]> wrote:

> Hi folks,
>
> I have to keep the flags of dnsmasq and openvpn in sync on
> several hosts, even though some hosts are just a hot standby,
> not running the service per default.
>
> Problem: The "flags" in rcctl is overloaded (probably for
> historical reasons): If flags is set to "NO", then the service
> is not run.
>
> Would it be possible to put this "NO" somewhere else to avoid
> a conflict?
>

I understand that this is how it always worked in openBSD and
that changes might introduce unexpected side effects.

Do you think the request to distinguish between the "usual" command
line flags and the information whether a service should be started
at boot time is unreasonable?


Regards
Harri

Reply | Threaded
Open this post in threaded view
|

Re: rcctl: howto set flags for disabled services?

Sebastian Benoit-3
Harald Dunkel([hidden email]) on 2017.11.14 07:48:01 +0100:

> On Wed, 18 Oct 2017 10:25:52 +0200
> Harald Dunkel <[hidden email]> wrote:
>
> > Hi folks,
> >
> > I have to keep the flags of dnsmasq and openvpn in sync on
> > several hosts, even though some hosts are just a hot standby,
> > not running the service per default.
> >
> > Problem: The "flags" in rcctl is overloaded (probably for
> > historical reasons): If flags is set to "NO", then the service
> > is not run.
> >
> > Would it be possible to put this "NO" somewhere else to avoid
> > a conflict?
> >
>
> I understand that this is how it always worked in openBSD and
> that changes might introduce unexpected side effects.
>
> Do you think the request to distinguish between the "usual" command
> line flags and the information whether a service should be started
> at boot time is unreasonable?

Thats only one solution to your problem, but not the only one.

Possible solutions that change the way rc.conf variables work are difficult,
and i dont see why they are needed.

Going to a rc.conf.local format where you have

  daemon=YES|NO
  daemon_flags=-foo

does not help you much. Then the next problem becomes how you switch from NO
to YES.

So here is one way to store your flags and switch your configs
automatically, with no changes to how rc.d works:

* run ifstated (or something else) to monitor your state
* use a script thats run on promotion/demotion of a machine, that script runs rcctl(8) as
  needed
* on state change, have ifstated (or something else) run the script

Now you have the flags of your programms in the arguments
of "rcctl set <service> flags ...", all in one file that you can keep in
sync over multiple machines.