Skip to content

Instantly share code, notes, and snippets.

@slumos
Created August 27, 2012 21:48
Show Gist options
  • Select an option

  • Save slumos/3492598 to your computer and use it in GitHub Desktop.

Select an option

Save slumos/3492598 to your computer and use it in GitHub Desktop.
#! /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