From 0a2ce6fab36b1de7384a0690fb936d797e7af3ae Mon Sep 17 00:00:00 2001 From: eclipse Date: Thu, 20 Mar 2025 12:02:36 +0100 Subject: [PATCH] fixed a bug in lftp commands; moved FPT credentials to untracked file --- .gitignore | 1 + deploy-via-ftp.sh | 27 ++++++++++++--------------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index 22e3ead..ec391b6 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ config.ini config.dev.ini config.prod.ini events.ini +deploy.conf diff --git a/deploy-via-ftp.sh b/deploy-via-ftp.sh index 7cc67ac..b5cf345 100755 --- a/deploy-via-ftp.sh +++ b/deploy-via-ftp.sh @@ -1,23 +1,20 @@ #!/usr/bin/env bash # -*- coding: utf8 -*- -# see here: https://stackoverflow.com/a/32235669 +# source login credentials and paths +source ./deploy.conf + +# get remote directory directly above target dir +# parameter expansion with '%' (remove suffix): cut off the rightmost occurrence of what comes after the percent sign +REMOTE_BASE_DIR=${REMOTE_DIR%/*} -#get username and password -USER="***REMOVED***" #Your username -PASS="***REMOVED***" #Your password -HOST="tobias-radloff.de" #Keep just the address -LOCAL_BASE_DIR="/home/tobias/Software/Websites/t-r.de" #Your local directory -REMOTE_BASE_DIR="/www" #FTP server directory lftp -c " open $HOST; user $USER $PASS; -lcd $LOCAL_BASE_DIR; -cd $REMOTE_BASE_DIR; -rm -rf tmp/; -mirror --reverse --continue output $REMOTE_BASE_DIR/tmp; -mv $REMOTE_BASE_DIR/tobias-radloff.de $REMOTE_BASE_DIR/tobias-radloff.de-old; -mv $REMOTE_BASE_DIR/tmp $REMOTE_BASE_DIR/tobias-radloff.de; -" - +rm -rf $REMOTE_BASE_DIR/tmp; +mirror --reverse --continue --verbose $LOCAL_DIR $REMOTE_BASE_DIR/tmp; +rm -rf $REMOTE_DIR-old; +mv $REMOTE_DIR $REMOTE_DIR-old; +mv $REMOTE_BASE_DIR/tmp $REMOTE_DIR; +" \ No newline at end of file