From 45bb8c4e2c2b4314a255354cd23cfb193dba58d5 Mon Sep 17 00:00:00 2001 From: Brendon Baumgartner Date: Thu, 10 Oct 2019 03:03:06 -0700 Subject: [PATCH] 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 * Update source/_docs/installation/centos.markdown Co-Authored-By: Fabian Affolter --- source/_docs/installation/centos.markdown | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/source/_docs/installation/centos.markdown b/source/_docs/installation/centos.markdown index 38a0d1aba1c..de9a401d718 100644 --- a/source/_docs/installation/centos.markdown +++ b/source/_docs/installation/centos.markdown @@ -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.