Can't fetch mails (via cron)
Added by Marcel Fuhrmann about 11 years ago
Hello,
I can fetch mails successfully with (as root):
/usr/local/bin/rake -f /usr/local/www/redmine/Rakefile redmine:email:receive_imap RAILS_ENV="production" \ host=EMAILSERVER \ username=USERNAME \ password=PASSWORD \ port=993 ssl=1 \ move_on_success=SUCCESS
But when I try to fetch mails using cron, it doesn't work.
*/5 * * * * root /usr/local/bin/rake -f /usr/local/www/redmine/Rakefile redmine:email:receive_imap RAILS_ENV="production" host=EMAILSERVER username=USERNAME password=PASSWORD port=993 ssl=1 move_on_success=SUCCESS
I also tried to run this command in a shell script and let cron start this script. But without success.
I don't get any error messages.
Any ideas?
Thanks for help.
--
Marcel
Replies (2)
RE: Can't fetch mails (via cron) - Added by Thomas Godard about 11 years ago
I have faced this kind of problem to fetch my emails too.
I have corrected it by adding some on my environment variables into my script :
My script :
#!/bin/sh
HOSTNAME=centos
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
cd /var/www/redmine ;
rake redmine:email:receive_imap RAILS_ENV=”production” ....
and it worked for me.
Here is my cron job also :
su apache -s /bin/sh -c "/var/www/redmine/mail.sh" > /var/www/redmine/mail.log 2>&1
RE: Can't fetch mails (via cron) - Added by Marcel Fuhrmann about 11 years ago
Thomas, thank you very much!
Now it works!