summaryrefslogtreecommitdiffstats
path: root/zarb-ml/mageia-dev/2012-October/019712.html
diff options
context:
space:
mode:
Diffstat (limited to 'zarb-ml/mageia-dev/2012-October/019712.html')
-rw-r--r--zarb-ml/mageia-dev/2012-October/019712.html176
1 files changed, 176 insertions, 0 deletions
diff --git a/zarb-ml/mageia-dev/2012-October/019712.html b/zarb-ml/mageia-dev/2012-October/019712.html
new file mode 100644
index 000000000..a6624a972
--- /dev/null
+++ b/zarb-ml/mageia-dev/2012-October/019712.html
@@ -0,0 +1,176 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
+<HTML>
+ <HEAD>
+ <TITLE> [Mageia-dev] Distrib-coffee big failure of the century
+ </TITLE>
+ <LINK REL="Index" HREF="index.html" >
+ <LINK REL="made" HREF="mailto:mageia-dev%40mageia.org?Subject=Re%3A%20%5BMageia-dev%5D%20Distrib-coffee%20big%20failure%20of%20the%20century&In-Reply-To=%3C5091A63A.70403%40zen.co.uk%3E">
+ <META NAME="robots" CONTENT="index,nofollow">
+ <META http-equiv="Content-Type" content="text/html; charset=us-ascii">
+ <LINK REL="Previous" HREF="019673.html">
+ <LINK REL="Next" HREF="019713.html">
+ </HEAD>
+ <BODY BGCOLOR="#ffffff">
+ <H1>[Mageia-dev] Distrib-coffee big failure of the century</H1>
+ <B>Barry Jackson</B>
+ <A HREF="mailto:mageia-dev%40mageia.org?Subject=Re%3A%20%5BMageia-dev%5D%20Distrib-coffee%20big%20failure%20of%20the%20century&In-Reply-To=%3C5091A63A.70403%40zen.co.uk%3E"
+ TITLE="[Mageia-dev] Distrib-coffee big failure of the century">zen25000 at zen.co.uk
+ </A><BR>
+ <I>Wed Oct 31 23:29:14 CET 2012</I>
+ <P><UL>
+ <LI>Previous message: <A HREF="019673.html">[Mageia-dev] Distrib-coffee big failure of the century
+</A></li>
+ <LI>Next message: <A HREF="019713.html">[Mageia-dev] Distrib-coffee big failure of the century
+</A></li>
+ <LI> <B>Messages sorted by:</B>
+ <a href="date.html#19712">[ date ]</a>
+ <a href="thread.html#19712">[ thread ]</a>
+ <a href="subject.html#19712">[ subject ]</a>
+ <a href="author.html#19712">[ author ]</a>
+ </LI>
+ </UL>
+ <HR>
+<!--beginarticle-->
+<PRE>On 30/10/12 21:49, Barry Jackson wrote:
+&gt;<i> On 30/10/12 21:29, Johnny A. Solbu wrote:
+</I>&gt;&gt;<i> On Tuesday 30 October 2012 22:21, Barry Jackson wrote:
+</I>&gt;&gt;&gt;<i> I will set --max-delete=500 locally in future.
+</I>&gt;&gt;&gt;<i>
+</I>&gt;&gt;&gt;<i> Any better ideas?
+</I>&gt;&gt;<i>
+</I>&gt;&gt;<i> I always run rsync manually twice. The first run I use &#171;-n&#187; to make
+</I>&gt;&gt;<i> sure my mirror isn't wiped, and then run rsync normally.
+</I>&gt;&gt;<i>
+</I>&gt;<i>
+</I>&gt;<i> I run it from a cron job via a script, so I could parse the output of a
+</I>&gt;<i> dry run and count deletes for example, then let it decide whether to run
+</I>&gt;<i> or not.
+</I>&gt;<i> Thanks - worth investigating :)
+</I>&gt;<i>
+</I>I wrote the attached script. It checks several mirrors until it finds
+one that has the normal number of files and does not fail for any other
+reason.
+
+Currently I have distrib-coffee at the top of the possible mirror list,
+but it is skipped because it only has a fraction of the files yet.
+
+It creates a couple of logs and runs as a cron job (or manually).
+
+If you feel inclined to use it please feel free to suggest any improvements.
+
+I certainly feel safer now.
+
+Barry
+-------------- next part --------------
+#!/bin/bash
+# ~/cronsync
+# Run with e.g. crontab:- 30 * * * * $HOME/cronsync
+# Set using crontab -e
+###################
+# List of mirrors in preference order to use:-
+mymirrors=( \
+&quot;<A HREF="rsync://distrib-coffee.ipsl.jussieu.fr:/pub/linux/Mageia/distrib">rsync://distrib-coffee.ipsl.jussieu.fr:/pub/linux/Mageia/distrib</A>&quot; \
+&quot;<A HREF="rsync://ftp.LinuxCabal.org/Mageia/distrib">rsync://ftp.LinuxCabal.org/Mageia/distrib</A>&quot; \
+&quot;<A HREF="rsync://ftp.acc.umu.se/mirror/mageia/distrib">rsync://ftp.acc.umu.se/mirror/mageia/distrib</A>&quot; \
+&quot;<A HREF="rsync://mirrors.kernel.org:/mirrors/mageia/distrib">rsync://mirrors.kernel.org:/mirrors/mageia/distrib</A>&quot; \
+&quot;<A HREF="rsync://mageia.c3sl.ufpr.br/mageia/distrib">rsync://mageia.c3sl.ufpr.br/mageia/distrib</A>&quot; \
+)
+# Set limit for loss of # of files on server before it is skipped
+allowdropfiles=100
+###################
+# Personal config:-
+myexcludes=&quot;--exclude=debug --exclude=SRPMS --exclude=barjac&quot;
+mydestination=&quot;/zmrepo/pub/linux/Mageia/&quot;
+###################
+
+# Get minimum file count for mirror (set at allowdropfiles files less than the last actual file count)
+[[ -f .cronsync ]] || echo &quot;140000&quot; &gt; $HOME/.cronsync
+minfiles=$(cat .cronsync)
+((actualfiles = $minfiles + $allowdropfiles))
+# Check a mirror
+chk_mirror()
+{
+echo &quot;Checking $1 ...&quot;
+chkout=$(rsync -rlptgoDhHSn \
+--stats \
+--delete-after \
+--delete \
+--delete-excluded \
+--protect-args \
+$myexcludes \
+&quot;$1&quot; \
+&quot;$mydestination&quot; | grep &quot;Number of files:&quot; )
+status1=&quot;$?&quot;
+files=$(echo $chkout | cut -d' ' -f4)
+[[ $files -lt $minfiles ]] &amp;&amp; echo &quot;$(date +%d/%m/%Y-%H:%M): Only $files/$actualfiles files in $1 !&quot; | tee -a $HOME/cronsync_error.log
+[[ $status1 &gt; 0 ]] &amp;&amp; echo &quot;$(date +%d/%m/%Y-%H:%M): Error: $status1 while checking $1&quot; | tee -a $HOME/cronsync_error.log
+([[ $status1 = 0 ]] &amp;&amp; [[ $files -gt $minfiles ]]) || return 1
+((chkcount = $files - $allowdropfiles))
+echo $chkcount &gt; $HOME/.cronsync
+return 0
+}
+
+# Loop through mirror list checking until one succeeds
+find_good_mirror()
+{
+for mirr in ${mymirrors[@]}; do
+chk_mirror $mirr
+[[ $? = 0 ]] &amp;&amp; { echo &quot;Found good mirror - $mirr&quot;; return 0; }
+done
+return 1
+}
+
+#=======================Main Program starts here=====================
+
+# Check if rsync is already running (maybe last cron sync taking for ever?)
+ps aux | grep -q [r]sync
+if [[ $? &gt; 0 ]]; then
+
+# Find a good mirror from the list (with files in it)
+find_good_mirror || { echo &quot;$(date +%d/%m/%Y-%H:%M) Can't find a good mirror - aborting&quot; | tee -a $HOME/cronsync_error.log; exit 1; }
+
+echo &quot;Syncing from $mirr ...&quot;
+
+# Live run with --max-delete set to 1000 just in case ;)
+rsync -rlptgoDhHS \
+--progress \
+--stats \
+--delete-after \
+--delete \
+--max-delete=1000 \
+--delete-excluded \
+--protect-args \
+$myexcludes \
+&quot;$mirr&quot; \
+&quot;$mydestination&quot; | tee $HOME/cronsync_last.log
+
+status=$?
+[[ $status = 0 ]] &amp;&amp; { echo &quot;Update complete&quot;; exit 0; }
+[[ $status &gt; 0 ]] &amp;&amp; { echo &quot;Live run error - $(date +%d/%m/%Y-%H:%M) = $status&quot; &gt;&gt; $HOME/cronsync_error.log; exit 1; }
+else
+echo &quot;rsync already running, skipping update - $(date +%d/%m/%Y-%H:%M)&quot; &gt;&gt; $HOME/cronsync_error.log
+exit 1
+fi
+</PRE>
+
+
+<!--endarticle-->
+ <HR>
+ <P><UL>
+ <!--threads-->
+ <LI>Previous message: <A HREF="019673.html">[Mageia-dev] Distrib-coffee big failure of the century
+</A></li>
+ <LI>Next message: <A HREF="019713.html">[Mageia-dev] Distrib-coffee big failure of the century
+</A></li>
+ <LI> <B>Messages sorted by:</B>
+ <a href="date.html#19712">[ date ]</a>
+ <a href="thread.html#19712">[ thread ]</a>
+ <a href="subject.html#19712">[ subject ]</a>
+ <a href="author.html#19712">[ author ]</a>
+ </LI>
+ </UL>
+
+<hr>
+<a href="https://www.mageia.org/mailman/listinfo/mageia-dev">More information about the Mageia-dev
+mailing list</a><br>
+</body></html>