man/pulseaudio.1.xml.in | 4 +++- src/daemon/main.c | 8 ++++++++ src/daemon/systemd/user/pulseaudio.service.in | 2 ++ 3 files changed, 13 insertions(+), 1 deletion(-)
New commits: commit f303d402c11171e8640e03697a79c9070cd589be Author: Felipe Sateler <[email protected]> Date: Thu Aug 13 19:58:28 2015 -0300 pulseaudio.1: document that systemd notification only works without daemonization diff --git a/man/pulseaudio.1.xml.in b/man/pulseaudio.1.xml.in index e6291d8..650b417 100644 --- a/man/pulseaudio.1.xml.in +++ b/man/pulseaudio.1.xml.in @@ -130,7 +130,9 @@ License along with PulseAudio; if not, see <http://www.gnu.org/licenses/>. <p><opt>-D | --daemonize</opt><arg>[=BOOL]</arg></p> <optdesc><p>Daemonize after startup, i.e. detach from the - terminal.</p></optdesc> + terminal. Note that when running as a systemd service you should + use <opt>--daemonize=no</opt> for systemd notification to work. + </p></optdesc> </option> <option> commit 647c360c5004667caa38acfa857307173b55e114 Author: Felipe Sateler <[email protected]> Date: Thu Aug 13 19:58:27 2015 -0300 daemon: Use Type=notify for systemd service This ensures systemd knows when pulseaudio finishes loading, thus never marking pulseaudio as active if startup fails. diff --git a/src/daemon/main.c b/src/daemon/main.c index c0bf3b4..b460d39 100644 --- a/src/daemon/main.c +++ b/src/daemon/main.c @@ -1131,12 +1131,20 @@ int main(int argc, char *argv[]) { pa_log_info("Daemon startup complete."); +#ifdef HAVE_SYSTEMD_DAEMON + sd_notify(0, "READY=1"); +#endif + retval = 0; if (pa_mainloop_run(mainloop, &retval) < 0) goto finish; pa_log_info("Daemon shutdown initiated."); +#ifdef HAVE_SYSTEMD_DAEMON + sd_notify(0, "STOPPING=1"); +#endif + finish: #ifdef HAVE_DBUS if (server_bus) diff --git a/src/daemon/systemd/user/pulseaudio.service.in b/src/daemon/systemd/user/pulseaudio.service.in index e08ff1e..df42fc3 100644 --- a/src/daemon/systemd/user/pulseaudio.service.in +++ b/src/daemon/systemd/user/pulseaudio.service.in @@ -2,6 +2,8 @@ Description=Sound Service [Service] +# Note that notify will only work if --daemonize=no +Type=notify ExecStart=@PA_BINARY@ --daemonize=no Restart=on-failure _______________________________________________ pulseaudio-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits
