Subject: [bug#30701] [PATCH 2/4] services: Use a external pid file for PostgreSQL.

From: Christopher Baines <[email-masked]>
Date: Mon, 05 Mar 2018 08:27:55 +0000

Christopher Baines <[email-masked]> writes:

> Clément Lassieur <[email-masked]> writes:
>
>> Plus, there is no reason to use make-forkexec-constructor on pg_ctl
>> because pg_ctl returns after it has checked that the daemon is running.
>> For the same reason, Shepherd doesn't need to know about Postgres' PID.
>> All the hard work is done by pg_ctl.
>
> As the comment I made at the top, I did this when I was writing the
> system test. If you remove this patch, when you call (start-service
> 'postgres), it will return #f if the service starts successfully. If you
> tweak the service to make it fail to start (e.g. by changing the "start"
> action to something else), you get the same observable behaviour,
> start-service returns #f.
>
> The way this works for other services, normally through
> make-forkexec-constructor is that calling start-service will return the
> PID.
>
> While the system test does still add some value even without checking if
> the service has started, doing so would be really good. Even if it's not
> using the PID file approach, maybe the exit code of pg_ctl could be
> used? I'm not really sure why it isn't working like that already, as
> invoke usually returns either #t or #f...

Ah, I've just realised why this is the case, I was misreading the system
test results, it does actually return #t/#f, but as the system test was
expecting a number, it just returns #f to indicate failure.