I’m trying to run a small shell script but not having success.
The script runs fine when run from terminal but not when triggered by Home Assistant.
I’m trying to trace the run with the creation of a file located at /tmp/duck.log
, but it is not being created.
I’ve tried a few variations. Referring to /bin/ash
in configuration.yaml sometimes gives a different error code compared to using /bin/bash
.
The service touch_temp_slash_test
does not add an entry to home-assistant.log, but does not create a file at /tmp/test
. Running the command /bin/touch /tmp/test
from the terminal does create the file.
home-assistant.log shows an error:
2024-02-19 16:00:00.373 ERROR (MainThread) [homeassistant.components.shell_command] Error running command: `/bin/bash /mnt/data/supervisor/homeassistant/scripts/duckdns.sh`, return code: 127
NoneType: None
configuration.yaml
# Loads default set of integrations. Do not remove.
default_config:
# Load frontend themes from the themes folder
frontend:
themes: !include_dir_merge_named themes
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
shell_command:
update_duckdns: /bin/bash /mnt/data/supervisor/homeassistant/scripts/duckdns.sh
touch_temp_slash_test: /bin/touch /tmp/test
duckdns.sh
PATH=/usr/bin:/usr/sbin
/usr/bin/echo url="https://www.duckdns.org/update?domains=foo.duckdns.org&token=bar&ip=" | /usr/bin/curl -k -o /tmp/duck.log -K -
/usr/bin/printf "\n" >> /tmp/duck.log
/usr/bin/date >> /tmp/duck.log
Output of pwd
, -ls -l
, cat duckdns.sh
HA Version
- Core 2024.2.1
- Supervisor 2024.01.1
- Operating System 11.5
- Frontend 20240207.1
1 post - 1 participant