Change systemd unit files to create /var/log/mosquitto

This happens before starting the broker.

Also don't quit with an error if opening the log file isn't possible.

Closes #821.
pull/1769/head
Roger A. Light 5 years ago
parent abb31ffe8d
commit 5a56f066a8

@ -2,6 +2,10 @@ Broker:
- Fix usage message only mentioning v3.1.1. Closes #1713. - Fix usage message only mentioning v3.1.1. Closes #1713.
- Fix broker refusing to start if only websockets listeners were defined. - Fix broker refusing to start if only websockets listeners were defined.
Closes #1740. Closes #1740.
- Change systemd unit files to create /var/log/mosquitto before starting.
Closes #821.
- Don't quit with an error if opening the log file isn't possible.
Closes #821.
Client library: Client library:
- Improved documentation around connect callback return codes. Close #1730. - Improved documentation around connect callback return codes. Close #1730.

@ -1,5 +1,5 @@
[Unit] [Unit]
Description=Mosquitto MQTT v3.1/v3.1.1 Broker Description=Mosquitto MQTT Broker
Documentation=man:mosquitto.conf(5) man:mosquitto(8) Documentation=man:mosquitto.conf(5) man:mosquitto(8)
After=network.target After=network.target
Wants=network.target Wants=network.target
@ -10,6 +10,8 @@ NotifyAccess=main
ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
ExecReload=/bin/kill -HUP $MAINPID ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure Restart=on-failure
ExecStartPre=/bin/mkdir -m 740 -p /var/log/mosquitto
ExecStartPre=/bin/chown mosquitto: /var/log/mosquitto
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

@ -1,5 +1,5 @@
[Unit] [Unit]
Description=Mosquitto MQTT v3.1/v3.1.1 Broker Description=Mosquitto MQTT Broker
Documentation=man:mosquitto.conf(5) man:mosquitto(8) Documentation=man:mosquitto.conf(5) man:mosquitto(8)
After=network.target After=network.target
Wants=network.target Wants=network.target
@ -8,6 +8,8 @@ Wants=network.target
ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
ExecReload=/bin/kill -HUP $MAINPID ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure Restart=on-failure
ExecStartPre=/bin/mkdir -m 740 -p /var/log/mosquitto
ExecStartPre=/bin/chown mosquitto: /var/log/mosquitto
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

@ -114,7 +114,6 @@ int log__init(struct mosquitto__config *config)
log_destinations = MQTT3_LOG_STDERR; log_destinations = MQTT3_LOG_STDERR;
log_priorities = MOSQ_LOG_ERR; log_priorities = MOSQ_LOG_ERR;
log__printf(NULL, MOSQ_LOG_ERR, "Error: Unable to open log file %s for writing.", config->log_file); log__printf(NULL, MOSQ_LOG_ERR, "Error: Unable to open log file %s for writing.", config->log_file);
return MOSQ_ERR_INVAL;
} }
restore_privileges(); restore_privileges();
} }

Loading…
Cancel
Save