Running homeassistant via shellscript

328 views Asked by At

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.

1

There are 1 answers

0
Mark Setchell On

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'