[SOLVED] Linux scripts not working

Hi, I’m new and not very experienced. I’m trying to make a button that runs a Linux script
I installed HA as a VM under Proxmox
This is my /config/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

# Text to speech
tts:
  - platform: google_translate

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

# Script
shell_command:
  my_script: bash /config/script.sh

This is the button configuration

show_name: true
show_icon: true
type: button
tap_action:
  action: toggle
entity: switch.tasmota
hold_action:
  action: call-service
  service: shell_command.my_script
  data: {}
  target: {}

The script works because I tested it externally

I’ve been trying for two days with no luck :pensive:

Can you give me some help?
Thank you for your time

You would need to share the content of that script if your concern is that the script itself isn’t working. There’s nothing wrong with what you’ve posted as long as you’ve checked your config and restarted HA.

#!/bin/bash

echo "Montaggio HD esterno"

ssh -i /root/config/pve [email protected] mount /dev/sdb1 /mnt/3tb

echo "Avvio container PLEX 102"

ssh -i /root/config/pve [email protected] lxc-start 102

If I run the script from the HA terminal it works fine

Try running it inside the HA container by shelling into it with

docker exec -it homeassistant /bin/bash

and also reviewing the instructions here.

You have to use the community SSH & Web Terminal addon with protected mode off to be able to use docker commands.

Hi, my HA is installed in the VM not a container

If you installed HA OS in the VM, my last post still applies.

I made this modification:
/config/configuration.yaml

# Script
shell_command:
my_script: docker exec -it homeassistant /bin/bash /config/script.sh

This is script code

ssh -o UserKnownHostsFile=/config/ssh/known_hosts [email protected] -i /config/ssh/pve mount /dev/sdb1 /mnt/3tb

The script works only if I run it from the HA terminal :unamused:

OK
I read the guide carefully and succeeded

Thank you for your time