Created
August 27, 2012 21:48
-
-
Save slumos/3492598 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
| #! /usr/bin/zsh | |
| user="$1" | |
| env="$2" | |
| shift 2 | |
| function usage { | |
| cat <<EOF 2>&1 | |
| usage: app-run.sh user environment command args... | |
| user - the user to run as | |
| environment - the RAILS_ENV | |
| EOF | |
| } | |
| if [[ -z "$user" || -z "$env" ]]; then | |
| usage | |
| exit 1 | |
| fi | |
| sudo -u "$user" /usr/bin/env "PATH=$PATH" "RAILS_ENV=$env" bundle exec $* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment