I have a rake task which runs mailman under the rails environment.
I’d like to ensure that rake task is always running via a daemon.
My rake task is rake incoming_mail
How would I go about daemonising that?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you are on linux you could consider using start-stop-daemon.
start-stop-daemon -S --pidfile /var/run/incoming_mail.pid -u rails_user -d /path/to/your/rails/app -b -a "rake incoming_mail"To later gracefully kill the process you can use most of the arguments but replace -S with -K.
As always you can find more information on start-stop-daemon by reading the man pages.