Skip to content

Instantly share code, notes, and snippets.

@YarikST
Created October 10, 2019 16:29
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 YarikST/8ed537fe9f5a442855ca91e373287dfc to your computer and use it in GitHub Desktop.
Save YarikST/8ed537fe9f5a442855ca91e373287dfc to your computer and use it in GitHub Desktop.
sudo nano /usr/sbin/pull
#!/bin/bash
# Load RVM into a shell session *as a function*
printf "Load RVM.\n"
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then
# First try to load from a user install
source "$HOME/.rvm/scripts/rvm"
elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then
# Then try to load from a root install
source "/usr/local/rvm/scripts/rvm"
else
printf "ERROR: An RVM installation was not found.\n"
fi
APP=/var/www/safepal
cd $APP
printf "cd $APP.\n"
rvm gemset use 2.4.0@safepal --create
git add -A
git stash
git pull origin master
git stash apply
bundle install
npm install
rails db:migrate
rake assets:precompile
whenever --update-crontab
sudo service nginx stop
sudo service cron restart
sudo service redis restart
sudo service sidekiq restart
sudo service nginx start
printf "Completed.\n"
sudo chmod 755 /usr/sbin/pull
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment