Hello Team --
I'm having an issue executing a cron job check an IMAP mailbox. The rake command will work perfectly fine when executed in the terminal, but does not work when setup as a cron job. I'm at the end of my rope and can't figure it out! I've exhasted my Ruby and Linux knowledge trying to get this to work. Again, either method will work perfect if in typed as a command in the terminal. Cron is definitely running.
I've searched everywhere with no luck. Any help would be greatly, greatly appreciated!!! Thank you!!!
Steve.
Here is what I've tried:
- Straight rake command in cron
In my crontab I inserted "*/5 * * * * rake -f /opt/bitnami/apps/redmine/Rakefile redmine:email:receive_imap RAILS_ENV="production" host=XX username=XX password=XX port=XX
- Creation of a shell script --
I tried creating a shell script and tried invoking the shell script from cron. I did this based on the instructions from: http://goo.gl/OGhP8
#!/bin/bash
export PATH=$PATH:/usr/local/rubygems/bin:/usr/local/rubygems/gems/bin
export RUBYLIB=/usr/local/rubygems/lib
export GEM_HOME=/usr/local/rubygems/gems
cd /opt/bitnami/apps/redmine/
rake -f /opt/bitnami/apps/redmine/Rakefile redmine:email:receive_imap RAILS_ENV="production" host=XX username=XX password=XX port=143
exit $ERROR
I chmod'd the .SH file to 770.
I was invoking the script in cron with the command:
*/1 * * * * /opt/bitnami/apps/redmine/script/redmine-rake-email.sh > /tmp/redmine-email.log 2>&1
When I run grep CRON /var/log/syslog
it produces Jun 28 02:11:01 ip-10-146-222-163 CRON[2609]: (bitnami) CMD (/opt/bitnami/apps/redmine/script/redmine-rake-email.sh > /tmp/redmine-email.log 2>&1)
, but doesn't actually do the rake, download the email,etc.
Any help would be greatly, greatly appreciated!!! Thank you!!!