fix: improve lftp mirror command for existing directories

Change mirror command to work better with existing target directories:
- Use cd/lcd to change to directories first
- Simplify mirror command to work from current directories
- Add mkdir fallback if target directory doesn't exist
- Fix SSL setting from ssl-allow to ssl-force for proper FTPS

This resolves issues when httpsdocs directory already exists on server.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-28 11:27:52 +01:00
co-authored by Claude
parent 90e5f3f2b6
commit acdce1d15e
2 changed files with 17 additions and 7 deletions
+10 -2
View File
@@ -33,7 +33,6 @@ NC='\033[0m' # No Color
# Configuration
FTPS_SERVER="www.markusgraf.ch"
FTPS_USER="gurix"
TARGET_DIR="httpsdocs"
SOURCE_DIR="public"
@@ -96,6 +95,13 @@ check_prerequisites() {
export FTPS_PASSWORD='your-password'"
fi
# Check if FTPS_USER is set
if [ -z "${FTPS_USER:-}" ]; then
error "FTPS_USER environment variable is not set.
Please set it before running this script:
export FTPS_USER='user'"
fi
success "All prerequisites met."
}
@@ -119,7 +125,9 @@ deploy() {
set net:max-retries 3;
set net:reconnect-interval-base 5;
open ftps://$FTPS_USER:$FTPS_PASSWORD@$FTPS_SERVER;
mirror --reverse --delete --verbose --parallel=3 $SOURCE_DIR $TARGET_DIR;
cd $TARGET_DIR || mkdir -p $TARGET_DIR;
lcd $SOURCE_DIR;
mirror --reverse --delete --verbose --parallel=3;
bye
"