Cron job not working
I am trying to write a scraper in ruby. It looks like this: Router + Worker and the main script that loads the router and call method callWorkers
.
I place the files in $OPENSHIFT_REPO_DIR.openshift/cron/minutely/
, and I have a simple bash script, which reads as follows: nohup ruby $OPENSHIFT_REPO_DIR.openshift/cron/minutely/main.rb &
.
My problem: If I SSH in my application in descent mode, go to app-root/repo/.openshift/cron/minutely
and execute the exact same command from my bash script ( nohup ruby $OPENSHIFT_REPO_DIR.openshift/cron/minutely/main.rb &
), my scripts work fine, but when cron tries to run the script - it doesn't work. I don't know how to handle this situation :(
source to share
I solved the problem. I dropped the bash script and I executed my ruby ββscript executable. I used this shebang: '#!/usr/bin/env ruby'
and now it works like a charm! I noticed that when openshift is running, cron tries to execute all the contents of the "detailed, hourly, daily, monthly" directories. Thanks a lot for your interest!
source to share