summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Sateler <fsateler@debian.org>2015-08-13 19:58:27 -0300
committerArun Raghavan <git@arunraghavan.net>2015-10-30 17:46:48 +0530
commit63b51b519235181deb4b50fba628585a716777fa (patch)
treeca9ca0ddd6928fae894753771ba02098ad836ed3
parent69a5d4913c926876633ebc39800c76fcbf16e52b (diff)
downloadpulseaudio-63b51b519235181deb4b50fba628585a716777fa.tar.gz
daemon: Use Type=notify for systemd service
This ensures systemd knows when pulseaudio finishes loading, thus never marking pulseaudio as active if startup fails.
-rw-r--r--src/daemon/main.c8
-rw-r--r--src/daemon/systemd/user/pulseaudio.service.in2
2 files changed, 10 insertions, 0 deletions
diff --git a/src/daemon/main.c b/src/daemon/main.c
index 8137121be..7734f5270 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 e08ff1efd..df42fc3ce 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