Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

init.d script #15

Closed
wants to merge 1 commit into from
Closed

init.d script #15

wants to merge 1 commit into from

Conversation

thedotedge
Copy link

Hi Chris!
The problem I had with workers is that they have to be started somehow: when a box goes down, you have to make sure you start them again automatically.
So I've thrown together a simple script that alongside with monit does the trick (tested on CentOS 5). Just copy it to /etc/init.d/php-resque.
Monit config snippet:
check process php-resque with pidfile /var/run/php-resque/php-resque.pid group queues start program = "/etc/init.d/php-resque start" stop program = "/etc/init.d/php-resque stop" if 5 restarts within 5 cycles then timeout

Current limitation is that it does only support 1 worker.

@s-alpha-1
Copy link

I suggest you config this using Supervisor instead of. Set numprocs to the number of workers you want
Sample program in supervisor for this

[program:resque]
directory = /path/to/script/
command = php index.php
environment = QUEUE=*
stopsignal = QUIT
stderr_logfile = /var/log/supervisor/%(program_name)s_error-%(process_num)s.log
stdout_logfile = /var/log/supervisor/%(program_name)s-%(process_num)s.log
numprocs = 2
process_name = "%(program_name)s-%(process_num)s"

@jbrower
Copy link

jbrower commented Jan 13, 2013

It's nice having an autostart script, but before a really effective method can be used, the way that resque forks off additional workers when COUNT > 1 should be changed. That way there is just one process to manage regardless of how many workers you have on that server.

@jbrower
Copy link

jbrower commented Jan 28, 2013

Pull request #83 seems to fix the issue that I explained. It provides one management process that takes care of everything else.

@danhunsaker
Copy link
Contributor

Init scripts don't tend to be included with the master source code for a given project. This is mostly due to the differences between init script formatting and handling between different systems, though the fact that several operating system environments don't even use them to begin with contributes as well.

There are a number of solutions to this. One is to include a different init script for every system that is "supported" and let the user install the appropriate one for their system. The best, though, is usually to leave this to implementers, be they sysadmins, developers, or OS/package-manager maintainers.

That said, it's also useful to see what such scripts might look like in the meantime.

@ruudk
Copy link
Contributor

ruudk commented Mar 13, 2013

Why not just make a tutorial for it on the Wiki? I managed to do it using Supervisord and it works fine. No need for this to be included.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants