Skip to content

Instantly share code, notes, and snippets.

@siers
Created March 14, 2013 13:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save siers/5161187 to your computer and use it in GitHub Desktop.
Save siers/5161187 to your computer and use it in GitHub Desktop.
wrapper for rails -d functionality
r() {
if [ -z "$1" ]; then
rails
return
fi
case "$1" in
start)
shift
rails s -d "$@"
;;
stop)
pid="$(cat tmp/pids/server.pid 2> /dev/null)"
kill $pid &> /dev/null && echo "$pid killed" || echo "rails not started"
;;
restart)
shift
r stop
r start "$@"
;;
*)
rails "$@"
;;
esac
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment