Compare commits
No commits in common. "4e0aae0f011d00421af7f56cc2f9231482a20eb2" and "aa67146dab4953066b85586110f8f37e78f73f83" have entirely different histories.
4e0aae0f01
...
aa67146dab
@ -43,9 +43,6 @@ If you wish to override where pid files are stored to prevent duplicate module s
|
|||||||
### LOGPATH
|
### LOGPATH
|
||||||
If you wish to override where logs are stored, the default is `/var/log/mirror-sync` and the directory must have write access for the mirror user.
|
If you wish to override where logs are stored, the default is `/var/log/mirror-sync` and the directory must have write access for the mirror user.
|
||||||
|
|
||||||
### sync_timeout
|
|
||||||
Timeout before a sync is cancelled, defaults to `timeout 1d` which should work for most mirrors.
|
|
||||||
|
|
||||||
### max_errors
|
### max_errors
|
||||||
How many errors before an email is sent regarding the issue. This allows you to ignore anomolies.
|
How many errors before an email is sent regarding the issue. This allows you to ignore anomolies.
|
||||||
|
|
||||||
|
@ -26,7 +26,6 @@ ERRORFILE="" # To be filled by acquire_lock().
|
|||||||
error_count=0
|
error_count=0
|
||||||
max_errors=3
|
max_errors=3
|
||||||
tmpDirBase="$HOME/tmp"
|
tmpDirBase="$HOME/tmp"
|
||||||
sync_timeout="timeout 1d"
|
|
||||||
# Do not check upstream unless it was updated in the last 5 hours.
|
# Do not check upstream unless it was updated in the last 5 hours.
|
||||||
upstream_max_age=18000
|
upstream_max_age=18000
|
||||||
# Update anyway if last check was more than 24 hours ago.
|
# Update anyway if last check was more than 24 hours ago.
|
||||||
@ -51,7 +50,7 @@ fi
|
|||||||
|
|
||||||
# Load the required configuration file or quit.
|
# Load the required configuration file or quit.
|
||||||
if [[ -f /etc/mirror-sync.conf ]]; then
|
if [[ -f /etc/mirror-sync.conf ]]; then
|
||||||
# shellcheck source=/dev/null
|
# shellcheck disable=SC1090
|
||||||
source /etc/mirror-sync.conf
|
source /etc/mirror-sync.conf
|
||||||
else
|
else
|
||||||
echo "No configuration file defined, please setup a proper configuration file."
|
echo "No configuration file defined, please setup a proper configuration file."
|
||||||
@ -264,12 +263,12 @@ git_sync() {
|
|||||||
rm -f "$ERRORFILE"
|
rm -f "$ERRORFILE"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
new_error_count=$((error_count+1))
|
error_count=$((error_count+1))
|
||||||
if ((new_error_count>max_errors)); then
|
if ((error_count>max_errors)); then
|
||||||
mail_error "Unable to sync with git, check logs."
|
mail_error "Unable to sync with git, check logs."
|
||||||
rm -f "$ERRORFILE"
|
rm -f "$ERRORFILE"
|
||||||
fi
|
fi
|
||||||
echo "$new_error_count" > "$ERRORFILE"
|
echo "$error_count" > "$ERRORFILE"
|
||||||
fi
|
fi
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -304,7 +303,7 @@ aws_sync() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Run AWS client to sync the S3 bucket.
|
# Run AWS client to sync the S3 bucket.
|
||||||
eval "$sync_timeout" aws s3 sync \
|
eval timeout 1d aws s3 sync \
|
||||||
--no-follow-symlinks \
|
--no-follow-symlinks \
|
||||||
--delete \
|
--delete \
|
||||||
"$options" \
|
"$options" \
|
||||||
@ -346,7 +345,7 @@ ftp_sync() {
|
|||||||
log_start_header
|
log_start_header
|
||||||
|
|
||||||
# Run AWS client to sync the S3 bucket.
|
# Run AWS client to sync the S3 bucket.
|
||||||
$sync_timeout lftp <<< "mirror -v --delete --no-perms $options '${source:?}' '${repo:?}'"
|
timeout 1d lftp <<< "mirror -v --delete --no-perms $options '${source:?}' '${repo:?}'"
|
||||||
RT=${PIPESTATUS[0]}
|
RT=${PIPESTATUS[0]}
|
||||||
if (( RT == 0 )); then
|
if (( RT == 0 )); then
|
||||||
date +%s > "${timestamp:?}"
|
date +%s > "${timestamp:?}"
|
||||||
@ -398,7 +397,7 @@ wget_sync() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Run wget with configured options.
|
# Run wget with configured options.
|
||||||
eval "$sync_timeout" wget "$options" "'${source:?}'"
|
eval timeout 1d wget "$options" "'${source:?}'"
|
||||||
RT=${PIPESTATUS[0]}
|
RT=${PIPESTATUS[0]}
|
||||||
if (( RT == 0 )); then
|
if (( RT == 0 )); then
|
||||||
date +%s > "${timestamp:?}"
|
date +%s > "${timestamp:?}"
|
||||||
@ -406,12 +405,12 @@ wget_sync() {
|
|||||||
rm -f "$ERRORFILE"
|
rm -f "$ERRORFILE"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
new_error_count=$((error_count+1))
|
error_count=$((error_count+1))
|
||||||
if ((new_error_count>max_errors)); then
|
if ((error_count>max_errors)); then
|
||||||
mail_error "Unable to sync with lftp, check logs."
|
mail_error "Unable to sync with lftp, check logs."
|
||||||
rm -f "$ERRORFILE"
|
rm -f "$ERRORFILE"
|
||||||
fi
|
fi
|
||||||
echo "$new_error_count" > "$ERRORFILE"
|
echo "$error_count" > "$ERRORFILE"
|
||||||
fi
|
fi
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -442,7 +441,7 @@ debianMirror="file:${jigdo_pkg_repo:-}"
|
|||||||
nonusMirror="file:/tmp"
|
nonusMirror="file:/tmp"
|
||||||
include='.' # include all files,
|
include='.' # include all files,
|
||||||
exclude='^$' # then exclude none
|
exclude='^$' # then exclude none
|
||||||
jigdoDir=${jigdoDir}
|
jigdoDir=${jigdoDir}"
|
||||||
imageDir=${imageDir}
|
imageDir=${imageDir}
|
||||||
tmpDir=${tmpDirBase:?}/${arch}.${s}
|
tmpDir=${tmpDirBase:?}/${arch}.${s}
|
||||||
#logfile=${LOGPATH}/${MODULE}-${arch}.${s}.log
|
#logfile=${LOGPATH}/${MODULE}-${arch}.${s}.log
|
||||||
@ -527,8 +526,7 @@ build_trace_content() {
|
|||||||
# Total bytes synced per rsync stage.
|
# Total bytes synced per rsync stage.
|
||||||
total=0
|
total=0
|
||||||
if [[ -f $LOGFILE_SYNC ]]; then
|
if [[ -f $LOGFILE_SYNC ]]; then
|
||||||
all_bytes=$(sed -Ene 's/(^|.* )sent ([0-9]+) bytes received ([0-9]+) bytes.*/\3/p' "$LOGFILE_SYNC")
|
for bytes in $(sed -Ene 's/(^|.* )sent ([0-9]+) bytes received ([0-9]+) bytes.*/\3/p' "$LOGFILE_SYNC"); do
|
||||||
for bytes in $all_bytes; do
|
|
||||||
total=$(( total + bytes ))
|
total=$(( total + bytes ))
|
||||||
done
|
done
|
||||||
elif [[ -f $LOGFILE_STAGE1 ]]; then
|
elif [[ -f $LOGFILE_STAGE1 ]]; then
|
||||||
@ -636,7 +634,6 @@ rsync_sync() {
|
|||||||
fi
|
fi
|
||||||
eval post_hook="\$${MODULE}_post_hook"
|
eval post_hook="\$${MODULE}_post_hook"
|
||||||
eval jigdo_pkg_repo="\$${MODULE}_jigdo_pkg_repo"
|
eval jigdo_pkg_repo="\$${MODULE}_jigdo_pkg_repo"
|
||||||
export jigdo_pkg_repo
|
|
||||||
eval arch_configurations="\$${MODULE}_arch_configurations"
|
eval arch_configurations="\$${MODULE}_arch_configurations"
|
||||||
eval repo_type="\$${MODULE}_type"
|
eval repo_type="\$${MODULE}_type"
|
||||||
|
|
||||||
@ -696,7 +693,7 @@ rsync_sync() {
|
|||||||
|
|
||||||
# Run the rsync. Using eval here so extra_args expands and is used as arguments.
|
# Run the rsync. Using eval here so extra_args expands and is used as arguments.
|
||||||
stage1_started=$(date +%s)
|
stage1_started=$(date +%s)
|
||||||
eval "$sync_timeout" rsync -avH \
|
eval timeout 1d rsync -avH \
|
||||||
--human-readable \
|
--human-readable \
|
||||||
--progress \
|
--progress \
|
||||||
--safe-links \
|
--safe-links \
|
||||||
@ -761,7 +758,7 @@ rsync_sync() {
|
|||||||
|
|
||||||
# Run the rsync. Using eval here so extra_args expands and is used as arguments.
|
# Run the rsync. Using eval here so extra_args expands and is used as arguments.
|
||||||
stage2_started=$(date +%s)
|
stage2_started=$(date +%s)
|
||||||
eval "$sync_timeout" rsync -avH \
|
eval timeout 1d rsync -avH \
|
||||||
--human-readable \
|
--human-readable \
|
||||||
--progress \
|
--progress \
|
||||||
--safe-links \
|
--safe-links \
|
||||||
@ -897,7 +894,7 @@ EOF
|
|||||||
|
|
||||||
# Run the rsync. Using eval here so extra_args expands and is used as arguments.
|
# Run the rsync. Using eval here so extra_args expands and is used as arguments.
|
||||||
sync_started=$(date +%s)
|
sync_started=$(date +%s)
|
||||||
eval "$sync_timeout" "$QFM_BIN" \
|
eval timeout 1d "$QFM_BIN" \
|
||||||
-c "'$conf_path'" \
|
-c "'$conf_path'" \
|
||||||
"$extra_args" | tee -a "$LOGFILE_SYNC"
|
"$extra_args" | tee -a "$LOGFILE_SYNC"
|
||||||
RT=${PIPESTATUS[0]}
|
RT=${PIPESTATUS[0]}
|
||||||
|
Loading…
Reference in New Issue
Block a user