Restartdns not found

with new pull last night restartdns can not be found

pihole6:/# pihole restartdns
  [โœ—] /usr/local/bin/pihole: line 195: service: command not found

On FTL version vDev-78a424b, pihole restartdns works for me on Ubuntu 22.04 LTS (Hyper-V)

its prob docker related

The official docker is based on alpine. I'd be highly surprised if service is a valid command in there. @PromoFaux @yubiuser

Correct, there is no service command inside the container, which is why this is falling over.

I think I stared looking at a way of changing this a while back but then got distracted by other things.

I noticed that one can tell pihole-FTL to restart via the API (which is how the web interface does it I assume) and wondered if we could hook into that from the command line.

The alternative is to create a dummy service wrapper that mimics a real service and use that to manually reload the process, much like we do in the v5 container.

We could surely offer an option like this but what do we actually want to achieve with it (read as: why do we want to restart)? If you change any config option that requires an FTL restart, then it will happen automatically. If the process is stuck/crashed, then it will likely not react on API calls, either.

Yeah, I'm interested to know what the use case is here.

Coming back to this before I start rebasing Add a wrapper/mock for the `service` command by PromoFaux ยท Pull Request #1453 ยท pi-hole/docker-pi-hole ยท GitHub

I think we are probably agreed that there is no need to call pihole restartdns inside a container (or perhaps even on bare metal?)

If so, I will abandon 1453 and maybe look at adding in a monkeypatch to disable pihole restartdns inside the container (as we do with checkout etc)

Yeah, I don't think this is necessary. You can still use systemctl on bare metal if you ever need to do this. But my understanding of containers is that they do one thing and if this thing needs to be restarted ... so restart the whole thing!

1 Like

So looking at things. I think maybe we can just kill off the restartDNS() function in the pihole script..

There are still two places that use it in the core repo, namely list.sh and piholeLogFlush.sh - I guess these are two scripts that need some v6 love and probably don't need to use this function in future?

Thoughts on a postcard...

2 Likes

I'm probably late to the party but...

I use pihole dns in v5 also for acme dns challenges (TXT-records).

I add dns challenges on the fly to /etc/dnsmasq.d and then restartdns .

It's not an option to restart the whole container all the time - as this stops all dns requests for a long time.

I also have processes to update the IP of a machine (eg based on location: Home vs.VPN)

Any way to fix this in v6?

Thank you!

Is there an API solution to this nowadays in v6

There might be, I havent seen it yet. Running into additional problems as some parts of the API are undocumented.

The entire API documentation exists on your Pi-hole install already.

https://docs.pi-hole.net/api/

http://pi.hole/api/docs

Pi-hole API documentation

For version 6 yes. :slight_smile:

So, this should be doable.

This is in the version 6 category.

Yep! My original post as referenced by the poster was for v5 - apparently setting .txt records was not possible.