Versions: - Ruby 2.1.1 - Capistrano 2 - Rake / Rails / etc
Platform: - Working on.... RHEL 6 - Deploying to... RHEL 6 A part of the Deploy.rb: #before "deploy", "deploy:stop_app" #after "deploy", "deploy:start_app" after "deploy", "deploy:restart_app" namespace :deploy do task :update_code, :roles => :web, :except => { :no_release => true } do on_rollback { puts "DO NOT WANT TO ROLL BACK?" } strategy.deploy! finalize_update end task :stop_app, :roles => :web do run "sudo /etc/init.d/xyz stop", :shell => :bash end task :start_app, :roles => :web do run "sudo /etc/init.d/xyz start", :shell => :bash end task :restart_app, :roles => :web do run "sudo /etc/init.d/xyz restart", :shell => :bash end end I have the parameter in the 'deploy.rb', *set :user, 'a_user'* Q: Which user performs the task to restart the service (xyz) after the deployment of app (xyz)? I am getting the errors saying the xyz.pid doesn't exist, when it actually does. This is a part of the shell script while stopping the service. A part of the /etc/init.d/xyz case "$1" in start) printf "%-50s" "Starting $DAEMON_NAME..." cd $DIR [ -d $LOGPATH ] || mkdir $LOGPATH [ -f $LOGFILE ] || su $DAEMON_USER -c 'touch $LOGFILE' PID=`$PYTHON $DAEMON $DAEMON_OPTS > $LOGFILE 2>&1 & echo $!` #echo "Saving PID" $PID " to " $PIDFILE if [ -z $PID ]; then printf "%s\n" "Fail" else echo $PID > $PIDFILE printf "%s\n" "Ok" fi ;; status) printf "%-50s" "Checking $DAEMON_NAME..." if [ -f $PIDFILE ]; then PID=`cat $PIDFILE` if [ -z "`ps axf | grep ${PID} | grep -v grep`" ]; then printf "%s\n" "Process dead but pidfile exists" else echo "Running" fi else printf "%s\n" "Service not running" fi ;; stop) printf "%-50s" "Stopping $DAEMONNAME" PID=`cat $PIDFILE` cd $DIR if [ -f $PIDFILE ]; then kill -HUP $PID printf "%s\n" "Ok" rm -f $PIDFILE else printf "%s\n" "pidfile not found" fi ;; restart) $0 stop $0 start ;; *) echo "Usage: $0 {status|start|stop|restart}" exit 1 esac Capistrano log * executing `deploy:restart_app' * executing multiple commands in parallel -> "else" :: "sudo /etc/init.d/xyz restart" -> "else" :: "sudo /etc/init.d/xyz restart" -> "else" :: "sudo /etc/init.d/xyz restart" -> "else" :: "sudo /etc/init.d/xyz restart" servers: ["server1", "server2", "server3", "server4"] [server1] executing command [server2] executing command [server3] executing command [server4] executing command ** [out :: server1] Stopping ** [out :: server1] cat: /var/run/xyz.pid: No such file or directory ** [out :: server1] pidfile not found ** [out :: server1] Starting xyz... ** [out :: server2] Stopping ** [out :: server2] cat: /var/run/xyz.pid: No such file or directory ** [out :: server2] pidfile not found ** [out :: server2] Starting xyz... ** [out :: server2] Ok ** [out :: server1] Ok ** [out :: server3] Stopping ** [out :: server3] cat: /var/run/xyz.pid: No such file or directory ** [out :: server3] pidfile not found ** [out :: server4] Stopping ** [out :: server4] Ok ** [out :: server3] Starting xyz... ** [out :: server3] Ok ** [out :: server4] Starting xyz... ** [out :: server4] Ok command finished in 659ms Finished: SUCCESS I can cat the file as the deploy user just fine. -- You received this message because you are subscribed to the Google Groups "Capistrano" group. To unsubscribe from this group and stop receiving emails from it, send an email to capistrano+unsubscr...@googlegroups.com. To view this discussion on the web, visit https://groups.google.com/d/msgid/capistrano/56a2a2dd-fd26-4b14-a2da-0d7af37f8354%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.