1
我正在运行Rails 2.3.5。运行rake ts:从rake任务内的索引
在我的项目我在LIB /任务以下rake任务(test_task.rake):
13 14 * * * cd /sites/project/app && /sites/ruby/bin/rake RAILS_ENV=staging test_task
:
desc 'test_synchro_task'
task :test_synchro_task => :environment do
# A bunch of things that are properly executed (basically I am inserting
# in the database)...
# ...
# and once the above is done, I want the following to be executed,
# the sphinx index to be rebuild, but it is NOT :
system("cd /sites/project/app")
system("RAILS_ENV='staging' rake ts:index")
end
我通过包含以下项的crontab触发任务的执行
除了任务中的2个系统行之外,哪些id正确调用和执行。
请注意,当我把在我的项目脚本目录红宝石test.rb文件的2条系统线路,并使用Ruby的命令运行它:
ruby test.rb
的2个系统命令正确执行并且索引被正确地重建。
在我耙的任务,我试图通过替换那些2线系统:
或
@cmd="cd /sites/project/app; RAILS_ENV='staging' rake ts:index"
`#{@cmd}`
但耙TS:仍然没有执行索引。
任何想法为什么?
非常感谢。
伊夫
只是为了澄清。我的帖子中有一个错字。描述和任务名称确实可以,即:test_task和test_synchro_task。 – user1857699