[pulseaudio-discuss] [PATCH] Use Type=notify for systemd service

Peter Meerwald pmeerw at pmeerw.net
Fri Jul 31 00:23:58 PDT 2015


On Thu, 30 Jul 2015, Felipe Sateler wrote:

> This ensures systemd knows when pulseaudio finishes loading, thus never
> marking pulseaudio as active if startup fails.

I've seen many PA startup issues with systemd before, I think this is a 
good idea

> ---
>  src/daemon/main.c                             | 8 ++++++++
>  src/daemon/systemd/user/pulseaudio.service.in | 1 +
>  2 files changed, 9 insertions(+)
> 
> diff --git a/src/daemon/main.c b/src/daemon/main.c
> index 82dec01..24fe8dc 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..ae9e8e5 100644
> --- a/src/daemon/systemd/user/pulseaudio.service.in
> +++ b/src/daemon/systemd/user/pulseaudio.service.in
> @@ -2,6 +2,7 @@
>  Description=Sound Service
>  
>  [Service]
> +Type=notify
>  ExecStart=@PA_BINARY@ --daemonize=no
>  Restart=on-failure
>  
> -- 
> 2.4.6
> 
> _______________________________________________
> pulseaudio-discuss mailing list
> pulseaudio-discuss at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
> 

-- 

Peter Meerwald
+43-664-2444418 (mobile)


More information about the pulseaudio-discuss mailing list