Closed yepecece closed 6 years ago
I'm not familiar with pi-hole but can you look at some of the tips I provided here https://github.com/pponce/homebridge-script2/issues/8
Also, in case pi-hole works similarly how adb does which runs it's own shell, you may need to have your script open a shell and pass in the commands to it. See the examples in the issue i linked to.
Are you running the commands as the same user you're using to test in the terminal? That error looks like sudo is trying to prompt you for a password but it cannot as it's in a script. You could edit your sudoers file to ensure that the user homebridge can sudo those commands without password requirements.
Thanks for your help.
It now works.
Here are my 3 scripts just in case
on.sh
#!/bin/bash
# Enable Pi-Hole Script v1.0
sudo -u homebridge bash << EOF
pihole enable
EOF
off.sh
#!/bin/bash
# Enable Pi-Hole Script v1.0
sudo -u homebridge bash << EOF
pihole disable 5m
EOF
state.sh
#!/bin/bash
# Enable Pi-Hole Script v1.0
sudo -u homebridge bash << 'EOF'
{
pihole status web
}
EOF
and the on_value is set to "1"
I am trying to use this plugin with pi-hole scripts but get the following errors: pi sudo[1219]: pam_unix(sudo:auth): conversation failed pi sudo[1219]: pam_unix(sudo:auth): auth could not identify password for [homebridge]
What I am trying to achieve is to have a with to enable/disable pi-hole.
Here is my config: on.sh is "pihole enable" off.sh is "pihole disable" state.sh is "pihole status" on_value is "enabled"
https://discourse.pi-hole.net/t/the-pihole-command-with-examples/738
Also, my pi-hole does not have a password.
If I run the scripts from the terminal it works great but via homebridge I get the previous errors.
Thanks to le me know if you know hot to resolve this.