Re: systemd and non-existent service instances
On 19/07/20 9:34 pm, Andrei POPESCU wrote:
> On Du, 19 iul 20, 21:10:40, Richard Hector wrote:
>> Hi all,
>>
>> I'm running into a problem with systemd and my openvpn instances.
>>
>> To start a vpn, I run 'systemctl start openvpn-client@foo_host2' or
>> similar. That has to be an underscore, because as far as I can see,
>> using a hyphen/dash will break the instance mechanism. Of course, the
>> actual hostname has to have a hyphen, because you can't have an
>> underscore in the DNS.
>>
>> This means I will inevitably end up typing 'systemctl start
>> openvpn-client@foo-host2' by mistake.
>>
>> When that happens, it appears that systemd will try to start it, and
>> fail because foo-host2.conf doesn't exist - and try for ever. Showing
>> the status of foo_host2 works fine, of course, so I don't notice until I
>> look at the logs.
>>
>> Is this an inherent part of how systemd works, or is there a way to make
>> it return an error message, rather than silently trying the impossible?
>
> Without checking if this is even possible, try 'mask'ing the inexistent
> instances.
Hmm. I know I gave an example of a specific typo, but in the general
case there are rather a lot of non-existent possiblities :-)
Still, I might investigate this if there aren't better options.
Thanks,
Richard
Reply to: