Last active
December 14, 2015 02:48
-
-
Save ch1ago/5016203 to your computer and use it in GitHub Desktop.
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/sh | |
### BEGIN INIT INFO | |
# Provides: stalker_crown_production | |
# Required-Start: $remote_fs $syslog | |
# Required-Stop: $remote_fs $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Manage stalker process | |
# Description: Start, stop, restart stalker process for a specific application. | |
### END INIT INFO | |
set -e | |
export RAILS_ENV=production | |
# Feel free to change any of the following variables for your app: | |
TIMEOUT=${TIMEOUT-60} | |
APP_ROOT=/root/apps/crown_production/current | |
PID=/root/apps/crown_production/current/tmp/pids/stalker.pid | |
CMD="/sbin/start-stop-daemon --chdir $APP_ROOT --start --pidfile $PID -m -b --exec /usr/local/bin/bundle exec stalk config/stalker.rb" | |
AS_USER=root | |
set -u | |
run () { | |
if [ "$(id -un)" = "$AS_USER" ]; then | |
eval $1 | |
else | |
su -c "$1" - $AS_USER | |
fi | |
} | |
stop() { | |
echo "Trying to stop stalker_crown_production..." | |
/sbin/start-stop-daemon --quiet --stop --pidfile $PID || echo "Was Not Running" | |
echo "Stopped!" | |
} | |
start() { | |
stop | |
echo "Starting stalker_crown_production ..." | |
run "$CMD" | |
echo "Started!" | |
return 1 | |
} | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
*) | |
echo >&2 "Usage: $0 <start|stop>" | |
exit 1 | |
;; | |
esac |
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
triggering start callbacks for `stalker:start' | |
* 2013-02-22 17:17:59 17:17:59 == Currently executing `multiconfig:ensure' | |
* 2013-02-22 17:17:59 17:17:59 == Currently executing `stalker:start' | |
* executing "service stalker_crown_production start" | |
servers: ["rubyfactory.net"] | |
[rubyfactory.net] executing command | |
** [out :: rubyfactory.net] Trying to stop stalker_crown_production... | |
** [out :: rubyfactory.net] | |
** [out :: rubyfactory.net] /sbin/start-stop-daemon: warning: | |
** [out :: rubyfactory.net] failed to kill 9058: No such process | |
** [out :: rubyfactory.net] | |
** [out :: rubyfactory.net] Was Not Running | |
** [out :: rubyfactory.net] | |
** [out :: rubyfactory.net] Stopped! | |
** [out :: rubyfactory.net] | |
** [out :: rubyfactory.net] Starting stalker_crown_production ... | |
** [out :: rubyfactory.net] | |
** [out :: rubyfactory.net] Started! | |
** [out :: rubyfactory.net] | |
command finished in 184ms | |
failed: "sh -c 'service stalker_crown_production start'" on rubyfactory.net |
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
servers: ["rubyfactory.net"] | |
[rubyfactory.net] executing command | |
** [out :: rubyfactory.net] Trying to stop stalker_crown_production... | |
** [out :: rubyfactory.net] | |
** [out :: rubyfactory.net] /sbin/start-stop-daemon: warning: | |
** [out :: rubyfactory.net] failed to kill 9058: No such process | |
** [out :: rubyfactory.net] | |
** [out :: rubyfactory.net] Was Not Running | |
** [out :: rubyfactory.net] | |
** [out :: rubyfactory.net] Stopped! | |
** [out :: rubyfactory.net] | |
command finished in 442ms | |
deployer@debian:~/apps/yakkodeploy$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment