我有一个可以控制我的 redis 服务器的 capistrano 脚本。这是有问题的任务:
%w[start stop restart].each do |cmd|
desc "#{cmd}s redis-server"
task cmd, :roles => :app do
run "#{sudo} /etc/init.d/redis-server #{cmd}"
end
end
When I run this (deploying to a local vagrant VM) it says it's starts successfully:
> cap local redis:start
triggering load callbacks
* executing `local'
Deploying branch master
triggering start callbacks for `redis:start'
* executing `multistage:ensure'
* executing `redis:start'
* executing "sudo -p 'sudo password: ' /etc/init.d/redis-server start"
servers: ["192.168.33.10"]
Password:
[192.168.33.10] executing command
** [out :: 192.168.33.10] Starting redis-server:
** [out :: 192.168.33.10] redis-server.
command finished in 2054ms
但是,当我 ssh 进入时,redis-server 没有运行。如果我手动启动它,它就可以工作:
> sudo /etc/init.d/redis-server start
我得到与上面相同的输出,只是这次进程保持运行。
查看日志,/var/log/redis/redis.log
文件为空。
任何想法我做错了什么?我启动了其他类似的服务(nginx、unicorn、mysql 等),这些服务运行良好。