Created
July 26, 2016 05:22
-
-
Save jgatjens/1e12936329109d06fa54939c5ca9d670 to your computer and use it in GitHub Desktop.
Upload folder to a FTP using lftp command.
This file contains 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 | |
read -p "Are you sure you want to go to production? <y/N> " prompt | |
if [[ $prompt =~ [yY](es)* ]] | |
then | |
echo "---- UPDATE example.net SITE ----" | |
HOST="ftp.example.net" | |
USER="username" | |
PASS="password" | |
FTPURL="ftp://$USER:$PASS@$HOST" | |
LCD="/Users/username/Sites/project-name" | |
RCD="/public_html" | |
lftp -c "set ftp:list-options -a; \ | |
open '$FTPURL'; \ | |
lcd $LCD; \ | |
cd $RCD; \ | |
mirror --reverse --delete --only-newer --use-cache --verbose --allow-chown \ | |
--allow-suid --no-umask --parallel=2" | |
else | |
echo "Becarefull, bye !!" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment