Sphinx 重启后自动将 searchd.product.pid 所有权更改为所需所有者
我的服务器中有两个用户:root
和 development
。每次重新启动 Sphinx 时,searchd.Production.pid
的所有权始终更改为 root
。不过,我总是使用development
来完成任何上限、更新代码等。
我的 deploy.rb
中有这个:
after "deploy:update_code", "sphinx:stop"
after "deploy:migrate", "sphinx:start"
namespace :sphinx do
desc "Start Sphinx Searchd"
task :start, :roles => :app do
run "cd #{deploy_to}/current/; /usr/bin/rake ts:start RAILS_ENV=#{rails_env}"
end
desc "Stop Sphinx Searchd"
task :stop, :roles => :app do
run "cd #{deploy_to}/current/; /usr/bin/rake ts:stop RAILS_ENV=#{rails_env}"
end
desc "Restart Sphinx Searchd"
task :restart, :roles => :app do
run "cd #{deploy_to}/current/; /usr/bin/rake ts:restart RAILS_ENV=#{rails_env}"
end
end
但是这是使用 development
用户运行的,如果我是所有者,我只能更改文件的所有权。有什么想法吗?谢谢!
I have two users in my server: root
and development
. Everytime Sphinx is restarted, the ownership of searchd.production.pid
always changed to root
. I always use the development
to do any cap, update code, etc. though.
I have this in my deploy.rb
:
after "deploy:update_code", "sphinx:stop"
after "deploy:migrate", "sphinx:start"
namespace :sphinx do
desc "Start Sphinx Searchd"
task :start, :roles => :app do
run "cd #{deploy_to}/current/; /usr/bin/rake ts:start RAILS_ENV=#{rails_env}"
end
desc "Stop Sphinx Searchd"
task :stop, :roles => :app do
run "cd #{deploy_to}/current/; /usr/bin/rake ts:stop RAILS_ENV=#{rails_env}"
end
desc "Restart Sphinx Searchd"
task :restart, :roles => :app do
run "cd #{deploy_to}/current/; /usr/bin/rake ts:restart RAILS_ENV=#{rails_env}"
end
end
But then this is run using development
user, I can only change the ownership of a file if I am the owner. Any idea? Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这不是 capistrano 问题,而是 SSH 问题。
我猜您正在从部署的同一台服务器上运行 capistrano 。
使用哪个用户来运行“cap”并不重要,真正重要的是如果您“ssh”到您的服务器,您是什么用户。
如果您是“开发”用户并通过 ssh 连接到您的服务器,那么您是什么用户?
root?,然后修复您的 .ssh/config 文件。
你的deploy.rb看起来不错,但我会用以下方法干燥它:
This is not a capistrano issue but SSH.
I guess you are running capistrano from the same server to which you are deploying.
It doesn't matter what user do you use to run 'cap', what it really matters is what user you are if you 'ssh' to your server.
If you are 'development' user and ssh to your server, what user are you ?
root?, then fix your .ssh/config file.
Your deploy.rb looks good, but I would DRY it with: