I have a bash script to let an IP cam take a picture and mail it to me. The mailing part still works but removing and writing the new snapshot to the directory doesn’t:
When I execute the script manually I have no problem and the picture is saved in the right place. But when I trigger it via HA it doesn’t work. The previous pictures stay in the destination folder.
I’ve put the path where the script is located in the directory whitelist.
When I execute the command in the terminal the file is created but when I use it in an automation nothing happens. Not even an error in the HA logs (as far as I can see).
It looks like HA can’t execute .sh anymore?
I messed around with a similar situation for a long time before I came to the conclusion that the running HA instance environment didn’t have any PATH variable defined so I had to explicitly state the absolute path to every element to make it work.
In my case I was using
Thank you for the reply but I don’t understand where to change to the complete path.
Is it in the script or in the shell_command line in the config yaml?
I have a shell command that uses sshpass to fire a script on my remote Mac to turn on MotionDetection with my CCTV system. Before 0.48 this command worked fine but now does not:
But as far as I can tell either should have been enough, depending on what’s in your actual script. If you add the user to sodoers you are allowed to run things with sudo, but then you removed the actual sudo command from your line, so either should be sufficient in my opinion. Could you check the the script runs without sudo rights too? Or do you actual need/use sudo within the actual script?
Btw. you can give sudo rights for single commands, which would reduce the risk.
I found working solution for me in useful post of BarryHampants. The exact description in this quote - “I had a few problems, one was trying to use directories - ie/ shell_command: !include_dir_named shell_commands. I had no errors but once I changed from directories to shell_command: !include shell_commands.yaml my shell commands started actually firing rather than just pretending to fire.”
In my system (version 0.49) shell commands with irsend started to work.