Skip to content

Instantly share code, notes, and snippets.

@fgalassi
Created May 20, 2014 14:01
Show Gist options
  • Save fgalassi/674197dbb9fce6423507 to your computer and use it in GitHub Desktop.
Save fgalassi/674197dbb9fce6423507 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
if [ "$1" == "" ]; then
echo "Usage: deploy <command>"
echo "Execute <command> in the mirror of the dir you are in under /var/www"
echo "e.g. deploy php scripts/BusinessKnowledgeImport.php --force --only-external-rules"
exit 1
fi
deploy_dir="/var/www"
project_dir="/root/projects/Onebip"
current_dir=$(pwd)
command=$@
mirror_dir="${deploy_dir}${current_dir#$project_dir}"
cd "$mirror_dir"
HOME=/tmp sudo -u www-data -g www-data $command
cd "$current_dir"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment