The `pid_file` option will now always attempt to write a pid file.

This happens regardless of whether the `-d` argument is used when
running the broker.

Closes #1845. Thanks to habazut.
pull/1885/head
Roger A. Light 5 years ago
parent 7bd3822817
commit 94c4108977

@ -22,6 +22,8 @@ Breaking changes:
method, or set `allow_anonymous true`. When the broker is run without a
configured listener, and so binds to the loopback interface, anonymous
connections are allowed.
- The `pid_file` option will now always attempt to write a pid file,
regardless of whether the `-d` argument is used when running the broker.
Broker:
- When running as root, if dropping privileges to the "mosquitto" user fails,

@ -860,9 +860,7 @@ log_timestamp_format %Y-%m-%dT%H:%M:%S
<listitem>
<para>Write a pid file to the file specified. If not given
(the default), no pid file will be written. If the pid
file cannot be written, mosquitto will exit. This
option only has an effect is mosquitto is run in daemon
mode.</para>
file cannot be written, mosquitto will exit.</para>
<para>If mosquitto is being automatically started by an
init script it will usually be required to write a pid
file. This should then be configured as e.g.

@ -395,7 +395,7 @@ int pid__write(struct mosquitto_db *db)
{
FILE *pid;
if(db->config->daemon && db->config->pid_file){
if(db->config->pid_file){
pid = mosquitto__fopen(db->config->pid_file, "wt", false);
if(pid){
fprintf(pid, "%d", getpid());

Loading…
Cancel
Save