Skip to content

Commit b310412

Browse files
committed
Update systemd part
1 parent 3d92b72 commit b310412

File tree

1 file changed

+23
-24
lines changed

1 file changed

+23
-24
lines changed

source/getting-started/autostart.markdown

+23-24
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ Upstart will launch init scripts that are located in the directory `/etc/init.d/
3232

3333
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:
3434

35-
3635
```bash
3736
$ sudo service hass-daemon start
3837
$ 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
4443
</div> <!-- UPSTART -->
4544

4645
<div class='advanced-installs systemd' markdown='1'>
47-
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:
48-
46+
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:
4947

5048
```bash
5149
$ ps -p 1 -o comm=
5250
```
5351

54-
If the preceding command returns the string `systemd`, you are likely using systemd.
55-
56-
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.
52+
If the preceding command returns the string `systemd`, you are likely using `systemd`.
5753

54+
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.
5855

5956
```bash
60-
$ su -c 'cat <<EOF >> /lib/systemd/system/home-assistant.service
57+
$ su -c 'cat <<EOF >> /lib/systemd/system/home-assistant@[your user].service
6158
[Unit]
6259
Description=Home Assistant
6360
After=network.target
6461
6562
[Service]
6663
Type=simple
67-
ExecStart=/usr/local/bin/hass
68-
# Next line is to run as a specific user
69-
# for Raspberry Pi users, keep it at 'pi'
70-
User=pi
64+
User=%i
65+
ExecStart=/usr/bin/hass
7166
7267
[Install]
7368
WantedBy=multi-user.target
7469
EOF'
7570
```
7671

77-
You need to reload systemd to make the daemon aware of the new configuration. Enable and launch Home Assistant after that.
72+
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.
73+
74+
```bash
75+
$ sudo wget https://raw.githubusercontent.com/balloob/home-assistant/master/script/home-assistant%40.service -O /lib/systemd/system/home-assistant@[your user].service
76+
```
7877

78+
You need to reload `systemd` to make the daemon aware of the new configuration. Enable and launch Home Assistant after that.
7979

8080
```bash
8181
$ sudo systemctl --system daemon-reload
82-
$ sudo systemctl enable home-assistant
83-
$ sudo systemctl start home-assistant
82+
$ sudo systemctl enable home-assistant@[your user]
83+
$ sudo systemctl start home-assistant@[your user]
8484
```
8585

8686
If everything went well, `sudo systemctl start home-assistant` should give you a positive feedback.
8787

88-
8988
```bash
90-
$ sudo systemctl status home-assistant -l
91-
● home-assistant.service - Home Assistant
92-
Loaded: loaded (/usr/lib/systemd/system/home-assistant.service; disabled; vendor preset: disabled)
93-
Active: active (running) since Thu 2015-06-25 23:38:37 CEST; 3min 13s ago
94-
Main PID: 8557 (python3.4)
95-
CGroup: /system.slice/home-assistant.service
96-
└─8557 /usr/bin/python3.4 -m homeassistant
89+
$ sudo systemctl status home-assistant@[your user] -l
90+
● home-assistant@fab.service - Home Assistant for [your user]
91+
Loaded: loaded (/usr/lib/systemd/system/home-assistant@[your user].service; enabled; vendor preset: disabled)
92+
Active: active (running) since Sat 2016-03-26 12:26:06 CET; 13min ago
93+
Main PID: 30422 (hass)
94+
CGroup: /system.slice/system-home\x2dassistant.slice/home-assistant@[your user].service
95+
├─30422 /usr/bin/python3 /usr/bin/hass
96+
└─30426 /usr/bin/python3 /usr/bin/hass
9797
[...]
9898
```
9999

100100
To get Home Assistant's logging output, simple use `journalctl`.
101101

102-
103102
```bash
104-
$ sudo journalctl -f -u home-assistant
103+
$ sudo journalctl -f -u home-assistant@[your user]
105104
```
106105

107106
</div> <!-- SYSTEMD -->

0 commit comments

Comments
 (0)