@@ -198,13 +204,13 @@ if [[ -z "$SRC_FOLDER" || -z "$DEST_FOLDER" ]]; then
exit 1
fi
# Strips off last slash. Note that it means the root folder "/"
# Strips off last slash from dest. Note that it means the root folder "/"
# will be represented as an empty string "", which is fine
# with the current script (since a "/" is added when needed)
# but still something to keep in mind.
# Don't think it would with DEST_FOLDER set to "/" though,
# but there's probably not a use case for this anyway.
SRC_FOLDER="${SRC_FOLDER%/}"
# However, due to this behavior we delay stripping the last slash for
# the source folder until after parsing for ssh usage.
DEST_FOLDER="${DEST_FOLDER%/}"
fn_parse_ssh
...
...
@@ -213,6 +219,13 @@ if [ -n "$SSH_DEST_FOLDER" ]; then
DEST_FOLDER="$SSH_DEST_FOLDER"
fi
if[-n"$SSH_SRC_FOLDER"];then
SRC_FOLDER="$SSH_SRC_FOLDER"
fi
# Now strip off last slash from source folder.
SRC_FOLDER="${SRC_FOLDER%/}"
for ARG in"$SRC_FOLDER""$DEST_FOLDER""$EXCLUSION_FILE";do
if[["$ARG"==*"'"*]];then
fn_log_error 'Source and destination directories may not contain single quote characters.'
...
...
@@ -269,10 +282,20 @@ fi
if[-n"$(fn_find "$INPROGRESS_FILE")"];then
if["$OSTYPE"=="cygwin"];then
# TODO: Cygwin reports the name of currently running Bash scripts as just "/usr/bin/bash"
# TODO: so the pgrep solution below won't work. Need to use "procps -wwFAH", grep
# TODO: the script name, and extract the process ID from it.
fn_log_warn "Cygwin only: Previous backup task has either been interrupted or it might still be active, but there is currently no check for this. Assuming that the task was simply interrupted."
# 1. Grab the PID of previous run from the PID file
RUNNINGPID="$(fn_run_cmd "cat $INPROGRESS_FILE")"
# 2. Get the command for the process currently running under that PID and look for our script name