Move to log files to /var/log/mirror
This commit is contained in:
1 parent
ecb9ab4c78
commit
8dbb1d90fc
6 files changed
+39
-8
No files matched your search
@@ -0,0 +1 @@
|
|||||||
|
*.swp
|
||||||
+2
-2
@@ -18,8 +18,8 @@ BASEDIR=/store/mirror/archlinux
|
|||||||
|
|
||||||
rsync --verbose --recursive --times --links --hard-links \
|
rsync --verbose --recursive --times --links --hard-links \
|
||||||
--stats --delete-after --ignore-errors \
|
--stats --delete-after --ignore-errors \
|
||||||
${RSYNCSOURCE} ${BASEDIR} &>> /opt/scripts/archlinux.log || fatal "Failed to rsync from ${RSYNCSOURCE}."
|
${RSYNCSOURCE} ${BASEDIR} &>> /var/log/mirror/archlinux.log || fatal "Failed to rsync from ${RSYNCSOURCE}."
|
||||||
|
|
||||||
date &>> /opt/scripts/archlinux.log
|
date &>> /opt/scripts/archlinux.log
|
||||||
echo "############################" &>> /opt/scripts/archlinux.log
|
echo "############################" &>> /var/log/mirror/archlinux.log
|
||||||
|
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
logfile='/opt/scripts/archlinux.log'
|
logfile='/var/log/mirror/archlinux.log'
|
||||||
|
|
||||||
fatal() {
|
fatal() {
|
||||||
echo "$1"
|
echo "$1"
|
||||||
|
|||||||
Executable
+30
@@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
logfile='/var/log/mirror/raspbian.log'
|
||||||
|
|
||||||
|
fatal() {
|
||||||
|
echo "$1"
|
||||||
|
echo -e "Last lines from log:\n"
|
||||||
|
tail $logfile
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
home="/store"
|
||||||
|
target="${home}/mirror/raspbian"
|
||||||
|
lock='/tmp/raspbiansync.lck'
|
||||||
|
source='rsync://archive.raspbian.org/archive'
|
||||||
|
|
||||||
|
[ ! -d "${target}" ] && mkdir -p "${target}"
|
||||||
|
|
||||||
|
exec 9>"${lock}"
|
||||||
|
flock -n 9 || exit
|
||||||
|
|
||||||
|
# only run rsync when there are changes
|
||||||
|
rsync -rtlvH --safe-links --delete-after --progress -h --timeout=600 --contimeout=60 -p \
|
||||||
|
--delay-updates --no-motd \
|
||||||
|
${source} \
|
||||||
|
"${target}" &>> $logfile || fatal "Failed to sync."
|
||||||
|
|
||||||
|
date >> $logfile
|
||||||
|
|
||||||
|
|
||||||
@@ -28,13 +28,13 @@ rsync -4 -q --recursive --times --links --hard-links \
|
|||||||
--stats --chmod=a+rx \
|
--stats --chmod=a+rx \
|
||||||
--exclude "Packages*" --exclude "Sources*" \
|
--exclude "Packages*" --exclude "Sources*" \
|
||||||
--exclude "Release*" \
|
--exclude "Release*" \
|
||||||
${RSYNCSOURCE} ${BASEDIR} &>> /opt/scripts/ubuntu_archive_two_stage.log || fatal "First stage of sync failed."
|
${RSYNCSOURCE} ${BASEDIR} &>> /var/log/mirror/ubuntu_archive_two_stage.log || fatal "First stage of sync failed."
|
||||||
|
|
||||||
rsync -4 -q --recursive --times --links --hard-links \
|
rsync -4 -q --recursive --times --links --hard-links \
|
||||||
--stats --delete --chmod=a+rx --delete-after \
|
--stats --delete --chmod=a+rx --delete-after \
|
||||||
${RSYNCSOURCE} ${BASEDIR} &>> /opt/scripts/ubuntu_archive_two_stage.log || fatal "Second stage of sync failed."
|
${RSYNCSOURCE} ${BASEDIR} &>> /var/log/mirror/ubuntu_archive_two_stage.log || fatal "Second stage of sync failed."
|
||||||
|
|
||||||
date -u > ${BASEDIR}/project/trace/$(hostname -f)
|
date -u > ${BASEDIR}/project/trace/$(hostname -f)
|
||||||
|
|
||||||
date &>> /opt/scripts/ubuntu_archive_two_stage.log
|
date &>> /var/log/mirror/ubuntu_archive_two_stage.log
|
||||||
|
|
||||||
+2
-2
@@ -26,8 +26,8 @@ fi
|
|||||||
|
|
||||||
rsync -q --recursive --times --links --hard-links \
|
rsync -q --recursive --times --links --hard-links \
|
||||||
--stats --delete-after \
|
--stats --delete-after \
|
||||||
${RSYNCSOURCE} ${BASEDIR} &>> /opt/scripts/ubuntu_releases.log || fatal "Failed to rsync from ${RSYNCSOURCE}."
|
${RSYNCSOURCE} ${BASEDIR} &>> /var/log/mirror/ubuntu_releases.log || fatal "Failed to rsync from ${RSYNCSOURCE}."
|
||||||
|
|
||||||
date -u > ${BASEDIR}/.trace/$(hostname -f)
|
date -u > ${BASEDIR}/.trace/$(hostname -f)
|
||||||
|
|
||||||
date &>> /opt/scripts/ubuntu_releases.log
|
date &>> /var/log/mirror/ubuntu_releases.log
|
||||||
Reference in new issue
Block a user