Why won't Shell_command run shell script

shell_command:
run_control: /bin/bash /homeassistant/config/ramp.sh

run_control: /bin /homeassistant/config/ramp.sh
run_control: sh /homeassistant/config/ramp.sh
run_control: /bin/bash “/homeassistant/config/ramp.sh”
run_control: /bin/bash /config/ramp.sh

no conceive combination will work.
however, it works when i execute it directly from from the terminal

no matter how i format the above, it just will NOT run.
soft reboot, or hard reboot

why?

I assume your are using HAOS as your installation type.
I would have thought the last one would have worked for you.

Anyway, here is what works for me:

  • Have the first line in the script contain the following: #!/bin/bash
  • Configuration.yaml:
shell_command:
  run_control: /config/ramp.sh

If that doesn’t work, then check the shell script’s execution privliges: ls -l /config/ramp.sh should show something like: -rwxr--r-- 1 root root which means the user root has “x” (execution) privileges enabled. If it is not set then type the following: u+x /config/ramp.sh

Thank you for the help.
the file does have #!/bin/bash as header and it executes well in terminal.
I also have -rwxr--r-- 1 root root root execution privileges on the file.
…still no go.

I am running HAOS core-2025.5.0 Installation type: Home Assistant OS

I also get running_script: false in trace. i’m not sure what that is about.

ummm, go to UI-Devloper Tools->Action and try to run shell_command.ramp and see what happens.

“from the terminal” may not mean you are using the actual HA Core container to run the script. If you can plug a keyboard into a console port (and plug in a display into say the HDMI port) on your HA, or if you have ssh setup to run on port 55555, then this will get you to the HAOS shell. Then go into the HA Core container: docker exec -it homeassistant \bin\bash and try running the script manually and see what happens.

hmmm…
i’m getting:

stdout: ""
stderr: "/bin/sh: /homeassistant/config/ramp.sh: not found"
returncode: 127

The HA Core container starts at /config/ (i.e. not /homeassistant/config).

I see.
However, the higher level of directory access i have from File Editor is /homeassistant i manually created config within that folder. How do i assess the Core’s /config. As also shown on the Configuration directory /config of the System information?

See my “from the terminal” above

THANK YOU!
that was very helpful. I was able to resolve the working directory. Now the script can be found.
you’re the best!.