Skip to content

Instantly share code, notes, and snippets.

Created February 14, 2017 09:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/fc00f82706b8d446fccfedf7e97ea692 to your computer and use it in GitHub Desktop.
Save anonymous/fc00f82706b8d446fccfedf7e97ea692 to your computer and use it in GitHub Desktop.
#!/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