我必须在红矿山上设置一个Cron作业来自动管理IMAP抓取。我试着提供尽可能多的关于我的环境的信息:
Redmine version 3.2.0.stable
Ruby version 2.1.5-p273 (2014-11-13) [x86_64-linux-gnu]
Rails version 4.2.5
Environment production
Database adapter Mysql2我已经将luismaia/redmine_email_fetcher安装为一个插件,并将其配置为gmail。到目前为止,我没有错误消息,通过在Redmine上尝试一个测试工具,我得到了一个成功的消息。
我总结了红矿山上的插件配置如下:
Configuration type: IMAP
Is configuration active? true
Host : imap.gmail.com
Port: 993
SSL? yes
Email username: mailAddress
Password: mailAccountPwd
Folder Name: Inbox
Method for unknown users: accept现在,我必须管理一份Cron工作。在此链接上:
我发现了以下情况:
*/5 * * * * www-data /usr/bin/rake -f /opt/redmine/Rakefile --silent redmine:plugins:email_fetcher:fetch_all_emails RAILS_ENV=production 2>&- 1>&我把它个人化如下:
*/5 * * * * www-data /usr/bin/rake -f /opt/redmine/Rakefile --silent redmine:plugins:email_fetcher:fetch_all_emails RAILS_ENV=production host=imap.gmail.com username=mailAddress password= mailAccountPwd port=993 --trace重点是:上面的线不起作用,我也不知道为什么。
我可以补充如下:
/usr/bin中我看到了rake2.1opt目录(/var/opt)为空。我希望我已以一种体面的方式解释了我的问题。
提前谢谢你,真的。
ps:我也试过:
*/5 * * * * www-data /usr/bin/rake2.1 -f /var/www/redmine/Rakefile redmine:plugins:email_fetcher:fetch_all_emails RAILS_ENV=production 2>&- 1>&- 但什么都没发生。
发布于 2016-05-23 15:52:59
测试哪个命令:
which rake对我来说,它在/usr/local/bin,而不是在/usr/bin中。
接下来,在crontab中启动命令之前,尝试将chdir放在您的redmine文件夹中:
*/5 * * * * cd /var/www/redmine/ && sudo /usr/local/bin/rake redmine:plugins:email_fetcher:fetch_all_emails RAILS_ENV=production 2>&- 1>&- 希望这能帮到你。
干杯,
Luc
https://stackoverflow.com/questions/37293523
复制相似问题