开发者

System calls are terminating

开发者 https://www.devze.com 2023-01-03 15:56 出处:网络
I am running rake task(which must be being launched for ~24 hours) but it stops in unexpected time. STRERR is empty.

I am running rake task(which must be being launched for ~24 hours) but it stops in unexpected time. STRERR is empty. The code which runs the task:

@bucket = Bucket.find(params[:id])
cmd = "#{`which rake`.chomp} bucket:generate[#{@bucket.id}] --trace 2>&1 > #{Rails.root}/log/bucket-#{@network.id}.log &" # 2> #{Rails.root}/log/bucket-#{@network.id}-error.log &"
system(cmd)
flash[:notice] = "Generation started"
redirect_to buckets_path

If I run the task from console it executes normally but task executed from controller stops after开发者_开发问答 some time...


Requests eventually time out; this is not the right place for such a command.

Instead, try something else to schedule tasks, like cron, or my scheduler daemon gem:

http://www.github.com/ssoroka/scheduler_daemon

If it needs to be driven from the controller, have it update a database entry or even write a file instead.

0

精彩评论

暂无评论...
验证码 换一张
取 消