lib/capistrano-daemonize/daemonize.rb in capistrano-daemonize-0.9.0 vs lib/capistrano-daemonize/daemonize.rb in capistrano-daemonize-0.9.1
- old
+ new
@@ -25,32 +25,33 @@
opts[:user] == fetch(:user) && try_sudo || ''
end
end
namespace name do
- task :start, options do
+ task :start, { desc: "Start #{name}" }.merge(options) do
run <<-SCRIPT
if [ -e #{daemonize_pidfile} ]; then
echo 'pidfile exists';
exit 1;
fi;
#{daemonize_sudo} /sbin/start-stop-daemon --pidfile #{daemonize_pidfile} \
--start --make-pidfile --chdir #{daemonize_chdir} --user #{daemonize_user} \
--background --exec #{command.split[0]} -- #{command.split[1..-1].join(' ')} \
-2>&1 >>#{daemonize_logfile} RAILS_ENV=#{rails_env}
+2>&1 >>#{daemonize_logfile} RAILS_ENV=#{rails_env};
+sleep 1
SCRIPT
end
- task :stop, options do
+ task :stop, { desc: "Stop #{name}" }.merge(options) do
run <<-SCRIPT
#{sudo_command} /sbin/start-stop-daemon --stop --pidfile #{daemonize_pidfile};
rm -f #{daemonize_pidfile}
SCRIPT
end
- task :restart, options do
+ task :restart, { desc: "Restart #{name}" }.merge(options) do
stop
start
end
end
@@ -59,6 +60,6 @@
after 'deploy:stop', "#{name}:stop"
after 'deploy:restart', "#{name}:restart"
end
end
end
-end
\ No newline at end of file
+end