Project

General

Profile

Redmine IMAP Ingest Script - can't run as non-root user

Added by Eric Fox over 2 years ago

Hi,

I got anonymous email ingest to tickets working with Redmine (Wiki documentation + Forum postings were great - wasn't too hard!), but I can't seem to run the bundler command as a non-root user or from cron on either the apache or root user. The script, and the Redmine application are owned by the apache user on a CentOS 7 system. If I run the script as root, emails are ingested as expected. I tried adding the path information to the script but it made no difference. I am running Redmine 4.2.3.

Cron Script:

#!/bin/bash
export RAILS_ENV=production
export GEM_HOME=/usr/local/rvm/gems/ruby-2.7.3/
export PATH=$PATH:/usr/local/rvm/gems/ruby-2.7.3/bin/:$GEM_HOME/bin
cd /var/www/redmine-4.2.3/
bundle exec rake redmine:email:receive_imap --trace \
host=imap.redacted \
port=993 \
ssl=true \
username=Redacted \
password=Redacted \
unknown_user=accept \
no_permission_check=1 \
project=testing \

Error:
/usr/local/rvm/gems/ruby-2.7.3/gems/bundler-2.2.31/lib/bundler/rubygems_ext.rb:17:in `remove_method': method `source'
not defined in Gem::Specification (NameError)
from /usr/local/rvm/gems/ruby-2.7.3/gems/bundler-2.2.31/lib/bundler/rubygems_ext.rb:17:in `<class:Specificati
on>'
from /usr/local/rvm/gems/ruby-2.7.3/gems/bundler-2.2.31/lib/bundler/rubygems_ext.rb:14:in `<module:Gem>'
from /usr/local/rvm/gems/ruby-2.7.3/gems/bundler-2.2.31/lib/bundler/rubygems_ext.rb:13:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.7.3/gems/bundler-2.2.31/lib/bundler.rb:10:in `require_relative'
from /usr/local/rvm/gems/ruby-2.7.3/gems/bundler-2.2.31/lib/bundler.rb:10:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.7.3/gems/bundler-2.2.31/exe/bundle:13:in `require_relative'
from /usr/local/rvm/gems/ruby-2.7.3/gems/bundler-2.2.31/exe/bundle:13:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.7.3/bin/bundle:26:in `load'
from /usr/local/rvm/gems/ruby-2.7.3/bin/bundle:26:in `<main>'
from /usr/local/rvm/gems/ruby-2.7.3/bin//ruby_executable_hooks:22:in `eval'
from /usr/local/rvm/gems/ruby-2.7.3/bin//ruby_executable_hooks:22:in `<main>'

I'm new to the world of Ruby applications, so any pointer would be appreciated. :)

Thanks!