CentOS boot script update (#10610)

* centos

* Update source/_docs/installation/centos.markdown

Fine with me. I did like having the "venv" in there to make it more obvious as to what is going on.

Co-Authored-By: Fabian Affolter <mail@fabian-affolter.ch>

* Update source/_docs/installation/centos.markdown

Co-Authored-By: Fabian Affolter <mail@fabian-affolter.ch>
This commit is contained in:
Brendon Baumgartner 2019-10-10 03:03:06 -07:00 committed by Fabian Affolter
parent c5befaf3ed
commit 45bb8c4e2c

View File

@ -52,22 +52,23 @@ You will need to enable the software collection each time you log on before you
### Systemd with Software Collections
To autostart Home Assistant using systemd follow the main [instructions](/docs/autostart/systemd/) and adjust the template as follows:
To autostart Home Assistant using systemd and a python36 (from SCL) virtual environment, follow the main [instructions](/docs/autostart/systemd/) and adjust the template as follows:
Filename: `/etc/systemd/system/home-assistant@homeassistant.service`
```txt
[Unit]
Description=Home Assistant
After=network.target
After=network-online.target
[Service]
Type=simple
User=homeassistant
# Make sure the virtualenv Python binary is used
Environment=VIRTUAL_ENV="/srv/homeassistant"
Environment=PATH="$VIRTUAL_ENV/bin:$PATH"
# ExecStart using software collection:
ExecStart=/usr/bin/scl enable rh-python36 -- /srv/homeassistant/bin/hass -c "/home/homeassistant/.homeassistant"
# %i means the username is derrived from the filename.
User=%i
# a python venv for hass exists in /opt/hass/venv
ExecStart=/srv/homeassistant/bin/hass
[Install]
WantedBy=multi-user.target
```
This works because the Python virtual environment was created using the SCL environment, thus there is no need to activate SCL.