mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-08 18:06:54 +00:00
Update systemd part
This commit is contained in:
parent
3d92b72248
commit
b310412fb1
@ -32,7 +32,6 @@ Upstart will launch init scripts that are located in the directory `/etc/init.d/
|
||||
|
||||
To install this script, download it, tweak it to you liking, and install it by following the directions in the header. This script will setup Home Assistant to run when the system boots. To start/stop Home Assistant manually, issue the following commands:
|
||||
|
||||
|
||||
```bash
|
||||
$ sudo service hass-daemon start
|
||||
$ sudo service hass-daemon stop
|
||||
@ -44,64 +43,64 @@ When running daemons, it is good practice to have the daemon run under its own u
|
||||
</div> <!-- UPSTART -->
|
||||
|
||||
<div class='advanced-installs systemd' markdown='1'>
|
||||
Newer linux distributions are trending towards using systemd for managing daemons. Typically, systems based on Fedora or Debian 8 or later use systemd. This includes Ubuntu releases including and after 15.04, CentOS, and Red Hat. If you are unsure if your system is using systemd, you may check with the following command:
|
||||
|
||||
Newer linux distributions are trending towards using systemd for managing daemons. Typically, systems based on Fedora or Debian 8 or later use systemd. This includes Ubuntu releases including and after 15.04, CentOS, and Red Hat. If you are unsure if your system is using `systemd`, you may check with the following command:
|
||||
|
||||
```bash
|
||||
$ ps -p 1 -o comm=
|
||||
```
|
||||
|
||||
If the preceding command returns the string `systemd`, you are likely using systemd.
|
||||
|
||||
If you want Home Assistant to be launched automatically, an extra step is needed to setup systemd. You need a service file to control Home Assistant with systemd.
|
||||
If the preceding command returns the string `systemd`, you are likely using `systemd`.
|
||||
|
||||
If you want Home Assistant to be launched automatically, an extra step is needed to setup `systemd`. You need a service file to control Home Assistant with `systemd`. If you are using a Raspberry Pi then replace the `[your user]` with `pi` otherwise use your user you want to run Home Assistant.
|
||||
|
||||
```bash
|
||||
$ su -c 'cat <<EOF >> /lib/systemd/system/home-assistant.service
|
||||
$ su -c 'cat <<EOF >> /lib/systemd/system/home-assistant@[your user].service
|
||||
[Unit]
|
||||
Description=Home Assistant
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/local/bin/hass
|
||||
# Next line is to run as a specific user
|
||||
# for Raspberry Pi users, keep it at 'pi'
|
||||
User=pi
|
||||
User=%i
|
||||
ExecStart=/usr/bin/hass
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF'
|
||||
```
|
||||
|
||||
You need to reload systemd to make the daemon aware of the new configuration. Enable and launch Home Assistant after that.
|
||||
There is also another [sample service file](https://raw.githubusercontent.com/balloob/home-assistant/master/script/home-assistant%40.service) available. To use this one, just download it.
|
||||
|
||||
```bash
|
||||
$ sudo wget https://raw.githubusercontent.com/balloob/home-assistant/master/script/home-assistant%40.service -O /lib/systemd/system/home-assistant@[your user].service
|
||||
```
|
||||
|
||||
You need to reload `systemd` to make the daemon aware of the new configuration. Enable and launch Home Assistant after that.
|
||||
|
||||
```bash
|
||||
$ sudo systemctl --system daemon-reload
|
||||
$ sudo systemctl enable home-assistant
|
||||
$ sudo systemctl start home-assistant
|
||||
$ sudo systemctl enable home-assistant@[your user]
|
||||
$ sudo systemctl start home-assistant@[your user]
|
||||
```
|
||||
|
||||
If everything went well, `sudo systemctl start home-assistant` should give you a positive feedback.
|
||||
|
||||
|
||||
```bash
|
||||
$ sudo systemctl status home-assistant -l
|
||||
● home-assistant.service - Home Assistant
|
||||
Loaded: loaded (/usr/lib/systemd/system/home-assistant.service; disabled; vendor preset: disabled)
|
||||
Active: active (running) since Thu 2015-06-25 23:38:37 CEST; 3min 13s ago
|
||||
Main PID: 8557 (python3.4)
|
||||
CGroup: /system.slice/home-assistant.service
|
||||
└─8557 /usr/bin/python3.4 -m homeassistant
|
||||
$ sudo systemctl status home-assistant@[your user] -l
|
||||
● home-assistant@fab.service - Home Assistant for [your user]
|
||||
Loaded: loaded (/usr/lib/systemd/system/home-assistant@[your user].service; enabled; vendor preset: disabled)
|
||||
Active: active (running) since Sat 2016-03-26 12:26:06 CET; 13min ago
|
||||
Main PID: 30422 (hass)
|
||||
CGroup: /system.slice/system-home\x2dassistant.slice/home-assistant@[your user].service
|
||||
├─30422 /usr/bin/python3 /usr/bin/hass
|
||||
└─30426 /usr/bin/python3 /usr/bin/hass
|
||||
[...]
|
||||
```
|
||||
|
||||
To get Home Assistant's logging output, simple use `journalctl`.
|
||||
|
||||
|
||||
```bash
|
||||
$ sudo journalctl -f -u home-assistant
|
||||
$ sudo journalctl -f -u home-assistant@[your user]
|
||||
```
|
||||
|
||||
</div> <!-- SYSTEMD -->
|
||||
|
Loading…
x
Reference in New Issue
Block a user