我正在尝试为redis-server添加一个启动-停止-重启方法
通过ssh登录到远程服务器,我可以运行
service redis-server restart
但是添加到deploy.rake中
%w[start stop restart].each do |command|
desc "#{command} Redis server."
task command do
on roles(:app) do
execute "service redis-server #{command}"
end
end
end
重新启动时出现错误
DEBUG [8410afb7] Command: service redis-server restart
DEBUG [8410afb7] Stopping redis-server:
DEBUG [8410afb7] redis-server.
DEBUG [8410afb7] Starting redis-server:
DEBUG [8410afb7] touch:
DEBUG [8410afb7] cannot touch ‘/var/run/redis/redis-server.pid’:
Permission denied
这是显而易见的,因为根是根: /run ...我该怎么解决它呢?我应该在我的主目录中安装redis-server吗?(如果可能?)
感谢您的建议
发布于 2015-08-13 00:26:29
我应该这样写:
execute :sudo, "service redis-server #{command}"
在我的deploy.rake食谱中
https://stackoverflow.com/questions/31970505
复制相似问题