Periodictask
多数项目通常会存在周期性重复活动,诸如每1个月完成一次机房巡检、每2个月实施一次数据灾难恢复安全演练等 ...
多数项目通常会存在周期性重复活动,诸如每1个月完成一次机房巡检、每2个月实施一次数据灾难恢复安全演练等 ...
![]() |
作者: | redmineplugins.cn Admin |
---|---|---|
主页: | https://github.com/jperelli/Redmine-Periodic-Task | |
版本库: | https://github.com/jperelli/Redmine-Periodic-Task | |
创建于: | 2025-01-11 | |
当前版本: | 6.0.0 | |
兼容性: | 6.0.*, 5.1.*, 5.0.*, 4.2.*, 4.1.*, 4.0.*, 3.4.*, 3.3.*, 3.2.*, 3.1.*, 3.0.* |
多数项目通常会存在周期性重复活动,诸如每1个月完成一次机房巡检、每2个月实施一次数据灾难恢复安全演练等等。此插件安装后会为项目新增一个'周期任务'模块。启用模块,项目应用菜单会新增'周期任务/Periodic Task’页签,通过该页面可以新增和管理项目周期性任务。
安装插件(linux)
配置方法(linux)
which bundle找到bundle的绝对路径, 例如 /usr/local/rvm/gems/ruby-2.1.0/bin/bundle
以 root权限执行 crontab -e
0 1 * * * cd /var/www/<redminedir>; /usr/local/rvm/gems/ruby-2.1.0/bin/bundle exec rake redmine:check_periodictasks RAILS_ENV="production"
再如,每10分钟一次:
*/10 * * * * cd /var/www/<redminedir>; /usr/local/rvm/gems/ruby-2.1.0/bin/bundle exec rake redmine:check_periodictasks RAILS_ENV="production"
如果想使用自己的语言包替换变量**DAY**,**WEEK**,**MONTH**,**MONTHNAME**,**YEAR**,**PREVIOUS_MONTHNAME**,**PREVIOUS_MONTH** ,可以在脚本中增加语言包变量参数,例如: LOCALE=“zh” (目前有效的值有 de, en, ja, tr, ru, tr, zh)
0 * * * * cd /var/www/<redminedir>; /usr/local/rvm/gems/ruby-2.1.0/bin/bundle exec rake redmine:check_periodictasks RAILS_ENV="production" LOCALE="de"
文件
Redmine-Periodic-Task-6.0.0.zip (28.8 KB)
文件
periodictask-5.0.0.zip (28.7 KB)
文件
periodictask-4.2.0.zip (44.2 KB)
文件
periodictask-4.1.0.zip (69.6 KB)
没有任何数据可供显示
# | 跟踪 | 状态 | 作者 | 主题 | 更新于 |
---|---|---|---|---|---|
322 | 缺陷 | 已解决 | he yang | 优先级 不能为空字符 | 2022-09-16 13:05 |
326 | 缺陷 | 已解决 | he yang | 插件没起作用 | 2024-10-21 21:19 |
379 | 缺陷 | 已解决 | wang hong | 周期任务安装后无法自动创建 | 2022-09-23 09:46 |
532 | 缺陷 | 待反馈 | hui he | 新版本不支持 | 2023-07-12 22:48 |
794 | 缺陷 | 待反馈 | shenwu zhang | 执行ruby bin/rails server -e production 不成功,报错信息是: | 2024-10-21 21:10 |
评论
添加评论
我的redmine版本是6.0.1,安装了插件6.0.0,日志中有这个警告并且没有生成任务WARNING: Can’t mass-assign protected attributes for Periodictask: id
plugins/periodictask/app/controllers/periodictask_controller.rb:55:in `update’
lib/redmine/sudo_mode.rb:78:in `sudo_mode’
wu jojo 解压后确保插件的目录名称是periodictask
@redmineplugins.cn Admin 以下是我的表字段,是否有关联
RAILS_ENV=production bundle exec rails runner 'p Periodictask.column_names’
......
......
[“id”, “project_id”, “tracker_id”, “assigned_to_id”, “author_id”, “subject”, “interval_number”, “interval_units”, “last_assigned_date”, “next_run_date”, “set_start_date”, “due_date_number”, “due_date_units”, “description”, “issue_category_id”, “estimated_hours”, “checklists_template_id”, “last_error”, “custom_field_values”]
@redmineplugins.cn Admin 你好我的插件目录名称没有问题,我在安装完配置了crontab每10分钟的任务,并新建了周期性任务,但是没有生效,没有任何新问题被建出
wu jojo 手动生成crontab任务,例如每隔10分钟执行:
手动执行:
另外,确保已经执行过安装命令:
cd <你的redmine目录>
@redmineplugins.cn Admin @redmineplugins.cn Admin 已经按照步骤操作,手动执行是可以的,但是在使用crontab的时候会有下面的报错,按照手动的环境变量,把环境变量都加到crontab中或者脚本中仍无法解决这个问题,命令的绝对路径都是根据which命令返回的值操作的,不知道是否还有其他办法处理这个报错
$ which bundle
/usr/local/bin/bundle
$ which rake
/usr/local/bundle/bin/rake
我的crontab脚本中的命令:
cd /usr/src/redmine
/usr/local/bin/bundle exec /usr/local/bundle/bin/rake redmine:check_periodictasks RAILS_ENV=“production”
报错:
bundler: failed to load command: /usr/local/bundle/bin/rake (/usr/local/bundle/bin/rake)
/usr/local/lib/ruby/3.3.0/bundler/definition.rb:599:in `materialize’: Could not find rails-7.2.2, rouge-4.5.1, mini_mime-1.1.5, actionpack-xml_parser-2.0.1, roadie-rails-3.2.0, marcel-1.0.4, mail-2.8.1, nokogiri-1.16.8-x86_64-linux, i18n-1.14.6, rbpdf-1.21.3, addressable-2.8.7, rubyzip-2.3.2, propshaft-1.1.0, rack-3.1.8, csv-3.2.9, net-imap-0.4.18, rotp-6.3.0, rqrcode-2.2.0, html-pipeline-2.13.2, sanitize-6.1.3, net-ldap-0.17.1, mini_magick-5.0.1, commonmarker-0.23.11, deckar01-task_list-2.3.2, pg-1.5.9, listen-3.9.0, yard-0.9.37, svg_sprite-1.0.3, rails-dom-testing-2.2.0, mocha-2.7.1, simplecov-0.22.0, puma-6.5.0, capybara-3.40.0, selenium-webdriver-4.27.0, rubocop-1.68.0, rubocop-performance-1.22.1, rubocop-rails-2.27.0, business_time-0.13.0, protected_attributes_continued-1.9.0, redmineup-1.0.11, rufus-scheduler-3.9.2, actioncable-7.2.2, actionmailbox-7.2.2, actionmailer-7.2.2, actionpack-7.2.2, actiontext-7.2.2, actionview-7.2.2, activejob-7.2.2, activemodel-7.2.2, activerecord-7.2.2, activestorage-7.2.2, activesupport-7.2.2, railties-7.2.2, roadie-5.2.1, racc-1.8.1, concurrent-ruby-1.3.4, htmlentities-4.3.4, rbpdf-font-1.19.1, public_suffix-6.0.1, date-3.4.1, chunky_png-1.4.0, rqrcode_core-1.2.0, crass-1.0.6, irb-1.14.2, reline-0.6.0, rb-fsevent-0.11.2, rb-inotify-0.11.1, svg_optimizer-0.3.0, thor-1.3.2, minitest-5.25.4, docile-1.4.1, simplecov-html-0.13.1, simplecov_json_formatter-0.1.4, nio4r-2.7.4, rack-test-2.1.0, regexp_parser-2.9.3, xpath-3.2.0, logger-1.6.3, rexml-3.4.0, websocket-1.2.11, json-2.9.0, language_server-protocol-3.17.0.3, parallel-1.26.3, parser-3.3.6.0, rainbow-3.1.1, rubocop-ast-1.37.0, ruby-progressbar-1.13.0, unicode-display_width-2.6.0, tzinfo-2.0.6, liquid-4.0.4, fugit-1.11.1, websocket-driver-0.7.6, zeitwerk-2.7.1, rack-session-2.0.0, rails-html-sanitizer-1.6.2, useragent-0.16.11, globalid-1.2.1, builder-3.3.0, erubi-1.13.0, timeout-0.4.3, benchmark-0.4.0, bigdecimal-3.1.8, connection_pool-2.4.1, drb-2.2.1, securerandom-0.4.1, rackup-2.2.1, rake-13.2.1, css_parser-1.21.0, rdoc-6.9.1, io-console-0.8.0, ffi-1.17.0-x86_64-linux-gnu, ast-2.4.2, et-orbi-1.2.11, raabro-1.4.0, websocket-extensions-0.1.5, loofah-2.23.1, psych-5.2.1, stringio-3.1.2 in locally installed gems (Bundler::GemNotFound)
from /usr/local/lib/ruby/3.3.0/bundler/definition.rb:193:in `specs’
from /usr/local/lib/ruby/3.3.0/bundler/definition.rb:260:in `specs_for’
from /usr/local/lib/ruby/3.3.0/bundler/runtime.rb:18:in `setup’
from /usr/local/lib/ruby/3.3.0/bundler.rb:164:in `setup’
from /usr/local/lib/ruby/3.3.0/bundler/setup.rb:32:in `block in <top (required)>'
from /usr/local/lib/ruby/3.3.0/bundler/ui/shell.rb:173:in `with_level’
from /usr/local/lib/ruby/3.3.0/bundler/ui/shell.rb:119:in `silence’
from /usr/local/lib/ruby/3.3.0/bundler/setup.rb:32:in `<top (required)>'
from /usr/local/lib/ruby/3.3.0/bundler/cli/exec.rb:56:in `require_relative’
from /usr/local/lib/ruby/3.3.0/bundler/cli/exec.rb:56:in `kernel_load’
from /usr/local/lib/ruby/3.3.0/bundler/cli/exec.rb:23:in `run’
from /usr/local/lib/ruby/3.3.0/bundler/cli.rb:455:in `exec’
from /usr/local/lib/ruby/3.3.0/bundler/vendor/thor/lib/thor/command.rb:28:in `run’
from /usr/local/lib/ruby/3.3.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command’
from /usr/local/lib/ruby/3.3.0/bundler/vendor/thor/lib/thor.rb:527:in `dispatch’
from /usr/local/lib/ruby/3.3.0/bundler/cli.rb:35:in `dispatch’
from /usr/local/lib/ruby/3.3.0/bundler/vendor/thor/lib/thor/base.rb:584:in `start’
from /usr/local/lib/ruby/3.3.0/bundler/cli.rb:29:in `start’
from /usr/local/lib/ruby/gems/3.3.0/gems/bundler-2.5.22/exe/bundle:28:in `block in <top (required)>'
from /usr/local/lib/ruby/3.3.0/bundler/friendly_errors.rb:117:in `with_friendly_errors’
from /usr/local/lib/ruby/gems/3.3.0/gems/bundler-2.5.22/exe/bundle:20:in `<top (required)>'
from /usr/local/bin/bundle:25:in `load’
from /usr/local/bin/bundle:25:in `<main>'
或许你的bundle路径不对?确认下实际该用哪一个,例如:which -a bundle
@redmineplugins.cn Admin
$ which -a bundle
/usr/local/bin/bundle
是一样的,手动执行命令是可以的,只是在crontab中无法使用
wu jojo 去掉rake多余的绝对路径
cd /usr/src/redmine
/usr/local/bin/bundle exec
/usr/local/bundle/bin/rakerake redmine:check_periodictasks RAILS_ENV=production@redmineplugins.cn Admin 谢谢,重新在脚本中把env设置后又可以了
支持Bitnami的Windows版本不?有没有用过?5.0.3版本
@yb bjhd 可以试试看。但需要使用windows的计划任务
不兼容5.0.3吗?为什么会出现安装完后redmine无法重启的情况啊~
@lee Vtophya 插件有可能没有正常安装,具体可以看下日志报什么错误
@贾 明森 需要在项目配置中启用“Periodictask”模块才可以
谢谢!
插件安装好重启完redmine后,在插件里面能看到这个插件但没有配置按钮,项目里没有出现‘周期任务’这一栏是什么原因?,
先要确保如下手动执行方式能看到效果,再考虑使用crontab做周期计划
建完任务后,怎么使用?已在crontab -e里创建每10分钟执行一次任务,但是似乎没有任何的效果。