docker-library / docker-library/redmine
RedmineReceivingEmails and the cronjob
Nobody has claimed this yet.
- Dominant language
- Shell
- Stars
- 237
- Forks
- 171
- PR merge metrics
- No merged PRs in 30d
Description
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
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with receive_imap.sh, its sourced .env file, the root crontab entry, and /var/log/cron-mail.log; compare the cron invocation with the manual run and the reported Rake environment error. Done means the scheduled command can run in the cron environment and mailbox harvesting creates the expected Redmine issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, ruby, shell
- Domain
- devops, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100