examples/chef_cookbook/templates/default/initd.erb in resque-pool-0.0.12.1.alpha vs examples/chef_cookbook/templates/default/initd.erb in resque-pool-0.1.0

- old
+ new

@@ -11,24 +11,29 @@ # Short-Description: resque-pool init script for <%= @app_name %> # Description: resque-pool manages the resque workers ### END INIT INFO # configure these values here or in /etc/default/resque-pool +# make sure your pidfile here matches your monitrc app_name="<%= @app_name %>" +pidfile="<%= @pidfile %>" app_dir="/data/${app_name}/current" run_as_user="deploy" -pidfile="/var/run/resque-pool-${app_name}.pid" sleep_time_during_restart=5 -bundler="bundle" +stop_schedule="QUIT/30/INT/10/KILL/5" +bundler="/usr/bin/bundle" environment="production" stdout_log="${app_dir}/log/resque-pool-${app_name}.stdout.log" stderr_log="${app_dir}/log/resque-pool-${app_name}.stderr.log" # override above values, and set any other env variables you need -if [ -f /etc/default/resque-pool ] ; then - . /etc/default/resque-pool +if [ -f /etc/default/resque ] ; then + . /etc/default/resque fi +if [ -f /etc/default/${app_name}_resque ] ; then + . /etc/default/${app_name}_resque +fi case "$1" in start) # I'm assuming that you are using bundler. If you are using rip or # something else, you'll need to change this. Remember to @@ -36,25 +41,28 @@ start-stop-daemon --start --pidfile ${pidfile} \ --chuid ${run_as_user} --chdir ${app_dir} \ --startas ${bundler} -- exec \ resque-pool -d -p ${pidfile} -E ${environment} -o ${stdout_log} -e ${stderr_log} ;; + reload) + start-stop-daemon --stop --pidfile ${pidfile} --signal HUP + ;; graceful-stop) start-stop-daemon --stop --pidfile ${pidfile} --signal QUIT ;; quick-stop) start-stop-daemon --stop --pidfile ${pidfile} --signal INT ;; stop) - start-stop-daemon --stop --pidfile ${pidfile} --signal QUIT/30/INT/10/KILL/5 + start-stop-daemon --stop --pidfile ${pidfile} --retry=${stop_schedule} ;; restart) $0 stop sleep ${sleep_time_during_restart} $0 start ;; *) - echo "Usage: $0 {start|stop|graceful-stop|quick-stop|restart}" + echo "Usage: $0 {start|stop|graceful-stop|quick-stop|restart|reload}" exit 1 ;; esac # vim:ft=sh