Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have followed this CentOS 5.2 Mongrel Cluster tutorial for starting mongrel_cluster at reboot on CentOS 5.2. However, I have to manually start mongrel_cluster at reboot.

Since that didn't work, I followed the advice in Set up Mongrel as a service and start it automatically on Centos 5.2. The key bits are:

chkconfig -add mongrel_cluster
chkconfig –level 345 mongrel_cluster on

Again... This sidn't work: I still have to manually start mongrel_cluster at boot. Finally, I tried adding "@reboot ..." to my crontab as so:

RAILS_ROOT=/path/to/root
# Restart Ferret Drb server on host reboot:
@reboot ${RAILS_ROOT}/script/ferret_server --root=${RAILS_ROOT} -e production start

# Restart rails apps (via Mongrel) on host reboot:
@reboot /etc/init.d/mongrel_cluster start

but again... I have to manually restart both Mongrel and Ferret!

Finally, I have followed the How to launch DRb server on reboot (linux) instructions, but I have to manually launch the Ferret DRb at reboot...

This is my first sysadmin gig, so I'm not even sure which logfile(s) to be looking at... If you need more information to help, please help me out & let me know where to look!

share|improve this question

2 Answers 2

up vote 3 down vote accepted

The answers to another question gave me an idea that seems to have worked. I've added the following to my /etc/rc.local file:

# ... and restart Mongrel
su - MyUserName -c "/etc/init.d/mongrel_cluster start"

# ... and restart ferret
su - MyUserName -c "cd /path/to/rails_root && ./script/ferret_server --root=/path/to/rails_root -e production  start"

... and whammy! Mongrel & Ferret DRb servers seem to reboot!

Is there a corresponding script to call when the system is shutting down (i.e. to properly kill mongrel_cluster & ferret_server)?

share|improve this answer

Pete - you can always stop the mongrel_cluster by using a similar command in your rc script:

su - YourUserName -c "/etc/init.d/mongrel_cluster stop"

That's standard initrc script handling. You'll usually find that a '/etc/init.d/scriptname' can be followed at least by either 'start' 'stop' or 'restart' (the last command almost always attempts to run the stop section of the script followed by the start script.

However, you shouldn't need to do this. When the system shuts down, all running processes are sent a termination signal which means they should terminate normally on shutdown. You can see this on the terminal outpout as it shuts down, although I'm not sure if it's logged by default on CentOS. (except if mongrel or ferret are configured to make logs)

Hope that helps.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.