i’m trying to execute a command/shell-script in the original shell (aka before) as part of a HA automation
sudo -u homeassistant -H -s
source /srv/homeassistant/bin/activate
any pointers would be helpful
i’m trying to execute a command/shell-script in the original shell (aka before) as part of a HA automation
sudo -u homeassistant -H -s
source /srv/homeassistant/bin/activate
any pointers would be helpful
Could you explain on what you mean by “original shell”? Are you trying to run a command before you switch to the homeassistant account or run a command as homeassistant?
Prior to switching to homeassistant user and prior to source bin/activate
Hmmmm, and you want to do this from within HA?
In a shell, it should be [your_command] && sudo -u homeassistant -H -s && source /srv/homeassistant/bin/activate
.
the easiest way is to execute the command with ssh user@ip command … this issues the command from the original shell environment prior to sudo -u homeassistant -H -s && source /srv/homeassistant/bin/activate
…
That’s pretty confusing. Why can’t you just log into the system (via telnet, ssh, whatever) and run a command without starting HA? Do you somehow have it automatically configured to start HA whenever you log in? Aren’t you running it as a service?
You probably need to explain more about how you have your system configured and how you installed HA and have it set to run. Because so far it sounds fairly non-standard.