getdnsapi / stubby

Stubby is the name given to a mode of using getdns which enables it to act as a local DNS Privacy stub resolver (using DNS-over-TLS).
https://dnsprivacy.org/dns_privacy_daemon_-_stubby/
BSD 3-Clause "New" or "Revised" License
1.2k stars 100 forks source link

scheduled task fails at startup #182

Open CarlTuckerson opened 5 years ago

CarlTuckerson commented 5 years ago

Stubby sometimes failed to start when booting into Windows 10. I modified Stubby.bat to wait for a successful ping response from the gateway on my ISP's network. In the scheduled task that was created when I installed Stubby, I just added my gateway IP address as an argument in the action starting stubby.bat. Stubby.bat is modified as follows:

@echo off

rem Check if an IP address has been specified set IPaddress=%1

rem If not, start as usual If [%IPaddress%]==[] goto :RunStubby

rem If an IP address is specified, wait for a good ping response :loop timeout 2 ping -n 1 %IPaddress% |find "TTL=" || goto :loop

:RunStubby "%~dp0stubby.exe" -C "%~dp0stubby.yml"

When the batch file is run from the task scheduler, stubby.exe isn't run until the IP address specified as an argument there successfully responds to a ping. With no IP address added as an argument, it runs the .exe immediately as usual.

Chaz6 commented 5 years ago

No matter what I do, I cannot get stubby to start at startup with Scheduled Tasks on Windows 10. I tried with the latest x64 msi. I can run it under my user account (using a Microsoft account login) and get successful dns lookup results.

CarlTuckerson commented 5 years ago

Never used a MSFT account. I created the scheduled task using the the command found in the stubby README.txt, from a command prompt run as administrator. For /RU I put in my admin username. It failed to run until I edited that to machine_name\admin_username. Then it accepted my admin credentials, and I made sure it was set to run even when the user is not logged on.

CarlTuckerson commented 5 years ago

The changes to the batch file did not result in 100% success in Stubby starting from a cold boot. I removed the changes to Stubby.bat and changed the scheduled task settings to:

if the task fails, restart every 1 minute; attempt to restart up to 10 times

Still not 100%. Failed at last startup when I left it at the login screen for a 1/2 hour or so. When I did log in, Stubby was not running, had to manually start the task.