Skip to content

Instantly share code, notes, and snippets.

@YarikST YarikST/Bash pull
Created Oct 10, 2019

Embed
What would you like to do?
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
You can’t perform that action at this time.