Created
February 14, 2017 09:17
-
-
Save anonymous/fc00f82706b8d446fccfedf7e97ea692 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/bash | |
# add to /etc/rc.local | |
# su -c '/home/rails/scripts/talkzzz' | |
# | |
# add to /home/rails/.profile | |
# PATH=$HOME/scripts/:$PATH | |
# | |
APP="api_hd" export RAILS_ENV=production | |
if [ "$USER" != "root" ]; then | |
echo "This script must be run under root user. Exiting ..." >&2; fi | |
# source /etc/profile.d/rvm.sh | |
cd /var/www/$APP | |
function start() { | |
do_start | |
} | |
function stop() { | |
do_stop | |
} | |
function restart() { | |
do_stop | |
do_start | |
} | |
function status() { | |
echo "Not implemented" | |
} | |
function do_start() { | |
puma --preload | |
} | |
function do_stop() { | |
kill `cat tmp/pids/puma.pid` | |
} | |
case "$1" in | |
start) | |
start | |
;; | |
restart|"") | |
restart | |
;; | |
stop) | |
stop | |
;; | |
status) | |
echo "Not inplemented yet" | |
;; | |
*) | |
echo "Usage: ${APP} [start|stop|restart|status]. Default is restart" >&2 | |
;; esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment