Anope IRC Services

Please login or register.

Login with username, password and session length
Advanced search  

News:

Pages: [1]   Go Down

Author Topic: 1.9.7 Cron services.chk issues  (Read 6609 times)

0 Members and 1 Guest are viewing this topic.

SuperPaul

  • Anope User
  • Offline Offline
  • Posts: 3
1.9.7 Cron services.chk issues
« 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:

Code: [Select]
~/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:

Code: [Select]
~/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:

Code: [Select]
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.
Logged

SuperPaul

  • Anope User
  • Offline Offline
  • Posts: 3
Re: 1.9.7 Cron services.chk issues
« Reply #1 on: January 24, 2013, 02:02:33 PM »

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?
Logged

Adam

  • Team
  • *
  • Offline Offline
  • Posts: 463
Re: 1.9.7 Cron services.chk issues
« Reply #2 on: January 24, 2013, 02:14:47 PM »

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.
Logged

Zystem Fryar

  • Anope User
  • Offline Offline
  • Posts: 2
Re: 1.9.7 Cron services.chk issues
« Reply #3 on: January 24, 2013, 02:44:40 PM »

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.

Logged

Adam

  • Team
  • *
  • Offline Offline
  • Posts: 463
Re: 1.9.7 Cron services.chk issues
« Reply #4 on: January 24, 2013, 02:46:48 PM »

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).
Logged

Zystem Fryar

  • Anope User
  • Offline Offline
  • Posts: 2
Re: 1.9.7 Cron services.chk issues
« Reply #5 on: January 24, 2013, 02:49:57 PM »

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.
Logged

Adam

  • Team
  • *
  • Offline Offline
  • Posts: 463
Re: 1.9.7 Cron services.chk issues
« Reply #6 on: January 24, 2013, 02:51:27 PM »

or -nofork > logs/whatever, yeah
Logged

SuperPaul

  • Anope User
  • Offline Offline
  • Posts: 3
Re: 1.9.7 Cron services.chk issues
« Reply #7 on: January 24, 2013, 06:00:41 PM »

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.
Logged
Pages: [1]   Go Up