重新启动应用程序不再与Cap 3.1和Rails 4一起使用 [英] Restart application no longer working with Cap 3.1 and Rails 4

查看:68
本文介绍了重新启动应用程序不再与Cap 3.1和Rails 4一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在升级到Rails 4和Cap 3.1之前,以下任务已起作用

The following task was working before we upgraded to Rails 4 and Cap 3.1

desc 'Restart application'
task :restart do
  on roles(:web), in: :sequence, wait: 5 do
    execute :touch, release_path.join('tmp/restart.txt')
  end
end

首先,我知道Cap 3.1不再隐式调用:restart了,所以我添加了以下内容:

First of all, I know Cap 3.1 doesn't implicitly call :restart anymore so I added the following:

after :publishing, :restart

但是,尝试触摸 restart.txt文件失败,因此Apache会重新加载应用程序。

However, it fails on attempting to 'touch' the restart.txt file so that Apache will reload the application.

cap aborted!
touch stdout: Nothing written
touch stderr: Nothing written
config/deploy.rb:46:in `block (3 levels) in <top (required)>'
config/deploy.rb:45:in `block (2 levels) in <top (required)>'
Tasks: TOP => deploy:restart
(See full trace by running task with --trace)
The deploy has failed with an error: #<SSHKit::Command::Failed: touch stdout: Nothing written
touch stderr: Nothing written
>

我仍然需要重启吗?通常看起来还可以,但是我想知道是否有可能由于找不到解决方法而出现问题。

Do I still need a restart? It generally seems okay but I'm wondering if there could be issues that come up by not finding a way to do this.

推荐答案

存在类似问题,尝试在服务器上运行此命令,并出现错误
touch:无法触摸'myappdir / releases / 20140416074158 / tmp / restart.txt':无此类文件或目录,所以我只需添加一行以创建 release_path / tmp dir:

Had a similar issue, tried to run this command on server and got an error touch: cannot touch 'myappdir/releases/20140416074158/tmp/restart.txt': No such file or directory, so I simply added a line to create a release_path/tmp dir:

desc 'Restart application'
task :restart do
  on roles(:web), in: :sequence, wait: 5 do
    execute :mkdir, '-p', "#{ release_path }/tmp"
    execute :touch, release_path.join('tmp/restart.txt')
  end
end

这篇关于重新启动应用程序不再与Cap 3.1和Rails 4一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆