Skip to content

Instantly share code, notes, and snippets.

@ayushghosh
Created October 14, 2014 13:07
Show Gist options
  • Save ayushghosh/bb04bcfa05c769e14f43 to your computer and use it in GitHub Desktop.
Save ayushghosh/bb04bcfa05c769e14f43 to your computer and use it in GitHub Desktop.
Automate Sync
#!/bin/bash
clear
echo "Syncing Api Server from GIT"
printf "\n\n---------------------------"
printf "\n\nSitching to user forge"
sudo su forge
printf "\n\nCurrent User: "
whoami
printf "\n\nChanging directory to API Server\n\n"
cd /home/forge/api
printf "\n\nCurrent Directory\n\n"
pwd
printf "\n\nPerforming Hard reset of Api Server\n\n"
git reset --hard
printf "\n\nGetting the updated repo\n\n"
git pull
printf "\n\nPerforming a composer update\n\n"
composer update
printf "\n\nMaking the storage directory writable\n\n"
sudo chmod -R 777 app/storage
printf "\n\nSetting the environment VARS\n\n"
cp /home/ubuntu/.env.php /home/forge/api/.env.php
printf "\n\nMigrating Databases to new changes\n\n"
php artisan migrate
printf "\n\nDumping class for autoloading\n\n"
php artisan dump-autoload
printf "\n\nOptimizing Framework\n\n"
php artisan optimize
printf "\n\nCalling Index of Api Server\n\n"
curl http://api.sourceeasy.com
printf "\n\n\nSync done\n\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment