On 3 July 2016 at 16:18, Samuel Thibault <sthiba...@debian.org> wrote:
> Hello,
>
> Christian Hofstaedtler, on Sun 03 Jul 2016 22:02:59 +0200, wrote:
>> * Samuel Thibault <sthiba...@debian.org> [160703 21:51]:
>> > Christian Hofstaedtler, on Sun 03 Jul 2016 21:43:01 +0200, wrote:
>> > > There's another minor thing I've noticed: espeakup takes a
>> > > relatively long time to write it's pidfile after forking.
>> >
>> > What do you mean by "long time"? seconds? minutes?
>>
>> No, in my testing it takes 0.2sec. So not really "long time", but
>> too long for systemd to notice the pidfile at the first try.
>
> Ok. But does systemd retry several times? If so, then we are as safe as
> the init.d script version, unless there are other side effects?
>
>> > > I see that this is actually a Debian change,
>> >
>> > Which change?
>>
>> That's debian/patches/pidfile.
>
> Ok, so the actual commit is b50297a94d01393cdd2f9cfc351452bae11d110d. I
> have added to the patch the following comment: "Create pidfile after
> espeakup is really ready, so that the starter knows he can now emit
> text, which will be properly read." It is notably useful for the
> installer.
>
>> I've tried reverting that patch, and then systemd finds the pidfile.
>
> But we do need the change :)

I think the daemonization needs to move later as well:

--- a/espeakup.c
+++ b/espeakup.c
@@ -115,17 +115,6 @@ int main(int argc, char **argv)
  signal(SIGINT, espeakup_sighandler);
  signal(SIGTERM, espeakup_sighandler);

- if (!debug) {
- /* become a daemon */
- daemon(0, 1);
-
- /* write our pid file. */
- if (create_pid_file() < 0) {
- perror("Unable to create pid file");
- return 2;
- }
- }
-
  /* initialize espeak */
  espeak_Initialize(AUDIO_OUTPUT_PLAYBACK, 0, NULL, 0);

@@ -147,6 +136,16 @@ int main(int argc, char **argv)
  return 4;
  }

+ if (!debug) {
+ /* become a daemon */
+ daemon(0, 1);
+ /* write our pid file. */
+ if (create_pid_file() < 0) {
+ perror("Unable to create pid file");
+ return 2;
+ }
+ }
+
  /* run the main loop */
  main_loop(&s);

-- 

Saludos,
Felipe Sateler

Reply via email to