new parameter PLUGIN_ONLY NEWER

- only uploads newer files (mirror parameter -n)
- ignores timestamp due to time differences between local and remote system (mirror parameter --ignore time)
- removes any files/folders from the server that are not present in the source directory (mirror parameter -e)
This commit is contained in:
Gottfried Mayer 2022-10-31 14:39:38 +01:00 committed by GitHub
parent 6b1af9d61e
commit 42ec53a83b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,6 +32,12 @@ else
PLUGIN_CHMOD="" PLUGIN_CHMOD=""
fi fi
if [ "$PLUGIN_ONLY_NEWER" = true ]; then
PLUGIN_ONLY_NEWER="-e -n --ignore-time"
else
PLUGIN_ONLY_NEWER=""
fi
if [ "$PLUGIN_CLEAN_DIR" = true ]; then if [ "$PLUGIN_CLEAN_DIR" = true ]; then
PLUGIN_CLEAN_DIR="rm -r $PLUGIN_DEST_DIR" PLUGIN_CLEAN_DIR="rm -r $PLUGIN_DEST_DIR"
else else
@ -76,6 +82,6 @@ lftp $PLUGIN_DEBUG -e "set xfer:log 1; \
set net:max-retries 3; \ set net:max-retries 3; \
$PLUGIN_PRE_ACTION; \ $PLUGIN_PRE_ACTION; \
$PLUGIN_CLEAN_DIR; \ $PLUGIN_CLEAN_DIR; \
mirror --verbose $PLUGIN_CHMOD -R $PLUGIN_MIRROR_OPTS $PLUGIN_INCLUDE_STR $PLUGIN_EXCLUDE_STR $(pwd)$PLUGIN_SRC_DIR $PLUGIN_DEST_DIR; \ mirror --verbose $PLUGIN_CHMOD -R $PLUGIN_ONLY_NEWER $PLUGIN_MIRROR_OPTS $PLUGIN_INCLUDE_STR $PLUGIN_EXCLUDE_STR $(pwd)$PLUGIN_SRC_DIR $PLUGIN_DEST_DIR; \
$PLUGIN_POST_ACTION;" \ $PLUGIN_POST_ACTION;" \
-u $FTP_USERNAME,$FTP_PASSWORD $PLUGIN_HOSTNAME -u $FTP_USERNAME,$FTP_PASSWORD $PLUGIN_HOSTNAME