Created
November 15, 2020 18:55
-
-
Save pettazz/646628176e365a897cd368907308de1b to your computer and use it in GitHub Desktop.
home-assistant systemd unit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Home Assistant service | |
Requires=docker.service | |
After=docker.service | |
[Service] | |
Restart=always | |
User=hassio | |
Group=hassio | |
WorkingDirectory=/opt/home-assistant | |
ExecStartPre=/usr/bin/docker-compose down | |
ExecStart=/usr/bin/docker-compose up | |
ExecStop=/usr/bin/docker-compose down | |
[Install] | |
WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add a user named
hassio
:sudo useradd -r hassio
Give it docker privileges:
sudo gpasswd -a hassio docker
Make it owner of the home-assistant dir:
sudo chown -R hassio:hassio /opt/home-assistant
Put this in
/etc/systemd/system/
, run asystemctl daemon-reload
, and you should be able tosudo service start home-assistant start
Run
systemctl enable home-assistant
to enable it automatically starting on every boot