In /usr/local/bin/pihole file there is a function called restartDNS that gets executed on running "pihole restartdns" in the terminal, I added a line "touch testfile" to this function just to verify so.
But when I hit the "Restart DNS Resolver" button (pihole via browser) looks like it doesn't execute this function, what function get executed then if it's not restartDNS?
The testfile file get created in the root directory, I also tried with echo "test", no problem with "pihole restartdns" command. The issue comes with "Restart DNS Resolver", looks like it's working even reloads the page and a message shows up "FTL was restarted" but doesn't seem to execute restartDNS
When you click on the button, the function is executed by PHP page.
This happens inside a subshell using a different user and you won't be able to see any echo command, because there is no terminal window opened to show.
Why do you think the function is not executed?
Are you having issues with FTL after clicking on this button?
Same thing happen with "Flush logs (last 24 hours)" button and the command "pihole flush".
The graphical option doesn't create the test file, both flush the pihole.log file though.
My intention is to find the code where domains are compared and do something when a particular domain is found.
Tail the systemd journal live when restarting the daemon to check:
sudo journalctl --full --follow --unit pihole-FTL
What exactly do you mean by "where domains are compared"?
Do you mean when a domain gets queries by a client via DNS?
Thats handled by the pihole-FTL binary/daemon: