Last active
May 3, 2017 14:40
-
-
Save elizoller/7f4e68f55ff14b2882a66f5ef5a866b2 to your computer and use it in GitHub Desktop.
init.d script for resque, usually in /etc/init.d/resque - note that paths are specific to where the app is installed, the user refers to the user which the rails app runs under, and the environment is specified for the cap command
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# resque workers | |
# | |
# chkconfig: 2345 95 05 | |
start(){ | |
echo "starting resque workers" | |
su - tapas_rails -c 'cd /export/home/tapas_rails/tapas_rails/current && bundle exec cap production resque:start' | |
} | |
stop(){ | |
echo "stopping resque workers" | |
su - tapas_rails -c 'cd /export/home/tapas_rails/tapas_rails/current && bundle exec cap production resque:stop' | |
} | |
status(){ | |
echo "checking resque status" | |
su - tapas_rails -c 'cd /export/home/tapas_rails/tapas_rails/current && bundle exec cap production resque:status' | |
} | |
restart(){ | |
echo "restarting resque workers" | |
su - tapas_rails -c 'cd /export/home/tapas_rails/tapas_rails/current && bundle exec cap production resque:restart' | |
} | |
case "$1" in | |
status) | |
status | |
;; | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
restart) | |
restart | |
;; | |
*) | |
echo "Usage: $0 {status|start|stop|restart}" | |
exit 1 | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment