Anope IRC Services
Anope Support => 2.0.x/1.9.x Support => Topic started by: SuperPaul on January 18, 2013, 05:22:41 PM
-
Hello,
I am having an issue with Anope 1.9.7 (and 1.9.6) with respect to cron.
If i run the services.chk script myself from a terminal, everything is fine, the binary runs and returns control to the terminal:
~/services/data$ ./services.chk
Anope 1.9.7, build #4, compiled 08:05:03 Jan 16 2013
Using configuration file conf/services.conf
Attempting to connect to uplink #1 XX.XX.XX.XX (XX.X.XX.XX), port XXXX
Successfully connected to uplink #1 XX.XX.XX.XX:XXXX
Successfully linked, launching into background...
However, if I allow cron to run the script, it never reaches the "launching into background" portion. Logging cron produces:
~/services/data$ ./services.chk
Anope 1.9.7, build #4, compiled 08:05:03 Jan 16 2013
Using configuration file conf/services.conf
Attempting to connect to uplink #1 XX.XX.XX.XX (XX.X.XX.XX), port XXXX
Successfully connected to uplink #1 XX.XX.XX.XX:XXXX
The result of this is an anope process, along with 2 other processes:
5537 ? Ss 0:00 /bin/sh -c /home/XXXX/services/data/services.chk > /
5539 ? S 0:00 /bin/sh /home/XXXX/services/data/services.chk
5540 ? S 0:00 ./services
This leads me to believe there is something going on with services returning control to the calling script. I whipped up another bash script to echo text before and after the services.chk script runs, and ONLY when called via cron, the final "Done" echo, never gets logged. So I'm pretty convinced the services binary doesn't properly return control (and launch into the background) when called by cron. I can't fathom why this would be.
Hopefully somebody has an idea.
-
I see a number of people have read this thread but no replies yet. Is this just not happening for other people? Is anybody running 1.9.7 with the cron script successfully functioning?
-
At startup services forks and then calls wait() on the child to wait for a SIGUSR2 or SIGCHLD signal before exiting. I suspect cron is blocking this.
-
I am having this behaviour,
But the script works fine.. just that, there are the 2 processes running...
If I were to shutdown services, both processes would go down, and next cron tick, a new set would startup.
-
One of them is the parent waiting for the signal from the child that magically never arrives for it to exit (it does this to keep the shell open so the child can print stuff to stdout for the user to see, such as link errors).
-
Maybe a -cron switch could be added to bypass that behaviour when used in a cron job.
For those that do have limited process allowance on shells, this could become an issue.
-
or -nofork > logs/whatever, yeah
-
That makes sense, and thanks for the input. Just so I'm clear though, this changed somehow between 1.9.5 and 1.9.6? I never had this issue previously.