0

I want to start homeassistant on startup or via shellscript. For some reason the run stops after the first command. Any help?

#!/bin/bash
sudo -u homeassistant -H -s
cd /srv/homeassistant
source bin/activate
hass
$SHELL

It just executes the first line and stops, no feedback on the commandline.

Elf
  • 1
  • Are you trying to run `cd ...` onwards as user "homeassistant" ? Perhaps put those lines in a separate file and sudo to run that whole script ? – John3136 Dec 01 '20 at 07:31

1 Answers1

0

I think you want to run 3 commands as user homeassistant, so try creating a new bash shell in which to run them and then do so like this:

sudo -u homeassistant bash -c 'cd /srv/homeassistant && source bin/activate && hass'
Mark Setchell
  • 191,897
  • 31
  • 273
  • 432