Skip to content

RedmineReceivingEmails and the cronjob #64

Open
@Inkimar

Description

@Inkimar

Following the guide here:
http://www.redmine.org/projects/redmine/wiki/RedmineReceivingEmails
Using the approach 'fetching emails from an IMAP server' and that is working great.
My project is here: https://github.com/DINA-Web/redmine-docker/tree/task760
I have created a script with the 'rake'-command to harvest my mailbox : receive_imap.sh with the following content

#!/bin/bash
source .env
echo "Mail $(date)" >>/var/log/cron-mail.log 2>&1 && rake -f /usr/src/redmine/Rakefile redmine:email:receive_imap RAILS_ENV=production host=imap.gmail.com port=993 ssl=1 username=$user password=$psw project=myproject tracker=Support

The user and the psw are in the .env-file
running the script manually works fine and an issue is created in my project 'myproject'.

The entry in the crontab (root account ) is like this >
* * * * * /usr/src/redmine/mail-script/receive_imap.sh

For the sake of testing I am running it right now every minute.
The only thing that I am seeing is the /var/log/cron-mail.log - no 'harvesting of my mailbox'.

Summary
Being new to Ruby.
One thing I see is that the crontab cannot find the environment for Ruby, it says it cannot find rake version 12.
As I understand this, this question boils down to 'the environment variables are not present with me when running crontab' - I tried to copy every environmental variable for root to a file and running source on that file when starting the script, but this does not help.

regards, Ingimar

Metadata

Metadata

Assignees

No one assigned

    Labels

    RequestRequest for image modification or feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions