Created
May 27, 2014 01:00
-
-
Save kythin/fce6576a4a36b6e233c5 to your computer and use it in GitHub Desktop.
Website Deploy Script (Bash + lftp)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
########## | |
# Deploy Script | |
# for deploying to servers that don't have git or ssh access | |
# RUN THIS FROM A VAGRANT SSH IF YOU AREN'T ON LINUX ALREADY. | |
########## | |
# prevents the certificate verification error. | |
sudo echo "set ssl:verify-certificate no" > ~/.lftp/rc | |
sudo echo "set ftp:ssl-allow no" >> ~/.lftp/rc | |
REMOTEPATH='/' | |
LOCALPATH='./' | |
FTPUSER='username' | |
FTPPASS='password' | |
FTPHOST='hostname.something.com' | |
#add as many as you want, this will prevent matching files from being removed from / overwritten / copied to the other side. | |
EXCLUDES='--exclude-glob .git --exclude-glob _sess/* --exclude-glob uploads/* --exclude-glob deploy.sh' | |
#careful with this, it will delete all the cpanel stuff if you point it to the root folder on the remote ftp without excluding them all. | |
DELETE='' #don't delete anything, just overwrite or add. | |
#DELETE=' --delete' #deletes ANYTHING on the remote that isn't in the local, other than the EXCLUDES. | |
#Do the thing. | |
sudo lftp -c "set ftp:list-options -a; open ftp://$FTPUSER:$FTPPASS@$FTPHOST; lcd $LOCALPATH; cd $REMOTEPATH; mirror --reverse $DELETE --use-cache --verbose --allow-chown --allow-suid --no-umask --parallel=2 $EXCLUDES" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment