I'm running my application on a VPS under Ubuntu 12.04 LTS.
And I have a problem with one daemon process for one of my applications. This process is called "delayed_job" (If not familiar - this is just a background task handler).
The problem with this process is that sometimes it gets killed (I suppose it is because I have limited amount of RAM on my server - only 1GB).
But the main problem with this thing is that it is not capable of booting again after a crash or "kill" signal, unlike "unicorn" (it is a Rails app server) processes, which are always getting re-booted no matter what happens to them.
And yes, this IS a very big deal, because a lot of application features are using background tasks.
Same story happens when there are maintenance works on the VPS (initiated by the owner of the VPS) and after the restart the "delayed_job" process is not present in the system anymore.
This is the command I run every single time to boot it up:
RAILS_ENV=production script/delayed_job start
It is a well-known problem, but the only solution I found on the Internet is this article: http://www.alexreisner.com/code/upstart that suggests using Linux's "upstart" feature with the "respawn" option that is capable of re-booting the process if it gets killed or crashed.
Even though the article is a bit out-dated, I found out that Ubuntu 12.04 should support this feature and I've created a symlink in
/etc/init directory (I've called it: delayed_job.conf) to the "delayed_job" file that I'd put in one of my applications folders (app_name/config, to be exact) - I've done everything this article says.
My problem is: when I try booting this new process (
start delayed_job) in the console I get:
delayed_job start/running, process 6000
But in fact - no "delayed_job" process is getting created at all.
And the status (
status delayed_job) of the initctl process is still:
After I execute
kill -9 6000 I get
-bash: kill: (6000) - No such process
So, this means that nothing gets executed. I've tried running this numerous times under different conditions - nothing, no avail. Is simply does not work.
Is there any thing I could try to make it work, or it is just useless ?