Howdy. I have a bash called backup.sh script in /config and I’ve added the shell_command to configuration.yaml:

shell_command:
  backup: /root/config/backup.sh

I’m running HAOS, the shell script has the correct owner:group and permissions. I can execute the script when I ssh into HAOS, but when I call the Shell Command: backup service from HA’s Developer Tools, I get:

stderr: "/bin/sh: /root/config/gitupdate.sh: not found"
returncode: 127

Any thoughts on this?

  • CondorWonder@lemmy.ca
    link
    fedilink
    English
    arrow-up
    6
    ·
    8 months ago

    Try executing just /config/backup.sh - the config directory is mapped into the HA container under /config, not under /root.

  • Mike Wooskey@lemmy.d.thewooskeys.comOP
    link
    fedilink
    English
    arrow-up
    1
    ·
    8 months ago

    So now I have a probably-related question: the script runs, but it won’t authenticate with my gitea repo:

    stderr: "Host key verification failed.\r\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists."
    returncode: 128
    

    Again, when I run the script while ssh-ed into HAOS, it works fine. So I suspect that when HA runs the shell script (e.g., via Developer Tools or an Automation), it’s doing it as a different user, or perhaps from a different container from which I haven’t yet copied the pubkey into gitea. What do you think?

    • ShunkW@lemmy.world
      link
      fedilink
      English
      arrow-up
      2
      ·
      edit-2
      8 months ago

      I’d guess that it’s running under a different user. You can find the user executing it and provide the key to that user via copying it to their ssh directory, or by using an identity file option for your command.

      Although now that I think of it, I’d create a separate key and provide that public key to keep it separate from your user account.