You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guide/installation/01_linux.md
+6-7
Original file line number
Diff line number
Diff line change
@@ -156,12 +156,13 @@ After=network.target
156
156
157
157
[Service]
158
158
Environment=NODE_ENV=production
159
-
Type=exec
160
-
ExecStart=/usr/bin/npm start
159
+
Type=notify
160
+
ExecStart=/usr/bin/node index.js
161
161
WorkingDirectory=/opt/zigbee2mqtt
162
162
StandardOutput=inherit
163
163
# Or use StandardOutput=null if you don't want Zigbee2MQTT messages filling syslog, for more options see systemd.exec(5)
164
164
StandardError=inherit
165
+
WatchdogSec=10s
165
166
Restart=always
166
167
RestartSec=10s
167
168
User=pi
@@ -170,7 +171,7 @@ User=pi
170
171
WantedBy=multi-user.target
171
172
```
172
173
173
-
> If you are using a Raspberry Pi 1 or Zero AND if you followed this [guide](https://gist.github.com/Koenkk/11fe6d4845f5275a2a8791d04ea223cb), replace `ExecStart=/usr/bin/npm start` with `ExecStart=/usr/local/bin/npm start`.
174
+
> If you are using a Raspberry Pi 1 or Zero AND if you followed this [guide](https://gist.github.com/Koenkk/11fe6d4845f5275a2a8791d04ea223cb), replace `ExecStart=/usr/bin/node index.js` with `ExecStart=/usr/local/bin/node index.js`.
174
175
175
176
> If you are using a Raspberry Pi or a system running from a SD card, you will likely want to minimize the amount of log files written to disk. Systemd service with `StandardOutput=inherit` will result in logging everything twice: once in`journalctl` through the systemd unit and once from Zigbee2MQTT default logging to files under `data/log`. You will likely want to keep only one of them:
176
177
>> Keep only the logs under `data/log` --> use `StandardOutput=null`in the systemd unit. **or**
@@ -179,7 +180,7 @@ WantedBy=multi-user.target
179
180
180
181
> If you want to use another directory to place all Zigbee2MQTT data, add `Environment=ZIGBEE2MQTT_DATA=/path/to/data` below `[Service]`
181
182
182
-
> Using `Type=exec`is convenient so the systemctl is informed ifthe service can't start because of problems in the unit definition.
183
+
> Using `Type=notify` makes systemd aware of when zigbee2mqtt has started up and is e.g. listening on its [Frontend](../configuration/frontend.md) sockets. This is useful for starting other, dependent systemd units or for using the `ExecStartPost=` attribute. For example, to allow a [Reverse Proxy](../configuration/frontend.md#nginx-proxy-configuration) to access zigbee2mqtt's Unix socket, you could add `ExecStartPost=setfacl -m u:www-data:rw /run/zigbee2mqtt/zigbee2mqtt.sock` to the `[Service]` section and `apt install acl`.
183
184
184
185
Save the file and exit.
185
186
@@ -200,9 +201,7 @@ pi@raspberry:/opt/zigbee2mqtt $ systemctl status zigbee2mqtt.service
200
201
Active: active (running) since Thu 2018-06-07 20:27:22 BST; 3s ago
201
202
Main PID: 665 (npm)
202
203
CGroup: /system.slice/zigbee2mqtt.service
203
-
ββ665 npm
204
-
ββ678 sh -c node index.js
205
-
ββ679 node index.js
204
+
ββ679 /usr/bin/node index.js
206
205
207
206
Jun 07 20:27:22 raspberry systemd[1]: Started zigbee2mqtt.
208
207
Jun 07 20:27:23 raspberry npm[665]: > [email protected] start /opt/zigbee2mqtt
0 commit comments