updated, tested and bugfixed script

This commit is contained in:
eclipse 2025-03-20 11:17:55 +01:00
parent 50afd04b7d
commit 4ffe9c6e42

30
deploy-via-ftp.sh Normal file → Executable file
View File

@ -1,17 +1,23 @@
#!/bin/bash
#!/usr/bin/env bash
# -*- coding: utf8 -*-
# see here: https://stackoverflow.com/a/32235669
#get username and password
USER=username #Your username
PASS=password #Your password
HOST="myftpserver.com" #Keep just the address
LCD="~/Desktop/localfolder" #Your local directory
RCD="/users/user" #FTP server directory
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 -f "
open $HOST
user $USER $PASS
lcd $LCD
mirror --continue --reverse --delete --verbose $LCD $RCD
bye
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;
"