How to figure out whether delayed job is running or not at background on staging.If it is stop so it should start running by checking some process pid or something .My problem is on staging delayed job stop sometimes and I am not able to figure it out why it happens so can any one tell me what should i possible do to solve this problem. This is the command i check for checking the status
RAILS_ENV=staging ./script/delayed_job status
but i need to do something which should check automatically whether delayed job is running or not .IF not it should start running
Create a shell script file in the root directory and place this code .
Then give permissions to the file
ps_out=`ps -ef | grep delayed | grep -v 'grep' | grep -v $0`
result=$(echo $ps_out | grep "$1")
if [[ "$result" != "" ]];then
echo "Running"
else
/path-to-your-project/delayed_job start
fi
Now add this in crontab
crontab -e