summaryrefslogtreecommitdiffstats
path: root/zarb-ml/mageia-dev/2012-November/019735.html
diff options
context:
space:
mode:
Diffstat (limited to 'zarb-ml/mageia-dev/2012-November/019735.html')
-rw-r--r--zarb-ml/mageia-dev/2012-November/019735.html166
1 files changed, 166 insertions, 0 deletions
diff --git a/zarb-ml/mageia-dev/2012-November/019735.html b/zarb-ml/mageia-dev/2012-November/019735.html
new file mode 100644
index 000000000..15009daa7
--- /dev/null
+++ b/zarb-ml/mageia-dev/2012-November/019735.html
@@ -0,0 +1,166 @@
+<!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=%3C509308A7.6030605%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="019732.html">
+ <LINK REL="Next" HREF="019782.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=%3C509308A7.6030605%40zen.co.uk%3E"
+ TITLE="[Mageia-dev] Distrib-coffee big failure of the century">zen25000 at zen.co.uk
+ </A><BR>
+ <I>Fri Nov 2 00:41:27 CET 2012</I>
+ <P><UL>
+ <LI>Previous message: <A HREF="019732.html">[Mageia-dev] Distrib-coffee big failure of the century
+</A></li>
+ <LI>Next message: <A HREF="019782.html">[Mageia-dev] Barry's cronsync script - Bugs
+</A></li>
+ <LI> <B>Messages sorted by:</B>
+ <a href="date.html#19735">[ date ]</a>
+ <a href="thread.html#19735">[ thread ]</a>
+ <a href="subject.html#19735">[ subject ]</a>
+ <a href="author.html#19735">[ author ]</a>
+ </LI>
+ </UL>
+ <HR>
+<!--beginarticle-->
+<PRE>On 01/11/12 20:51, Barry Jackson wrote:
+&gt;<i>
+</I>&gt;<i> See how it goes :)
+</I>&gt;<i>
+</I>Last update - honest - added proper file lock as the existing method was
+flakey - it's finished and I'm leaving it alone now :)
+Attached and also here:-
+<A HREF="http://paste.kde.org/588158/12522135/">http://paste.kde.org/588158/12522135/</A>
+
+-------------- next part --------------
+#!/bin/bash
+# ~/cronsync by barjac
+# 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://fr2.rpmfind.net/linux/mageia/distrib">rsync://fr2.rpmfind.net/linux/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;
+###################
+
+# Set minimum files for first run only
+[[ -f .cronsync ]] || echo &quot;140000&quot; &gt; $HOME/.cronsync
+# Get minimum file count for mirror (set at allowdropfiles files less than the last actual file count)
+minfiles=$(cat .cronsync)
+((actualfiles = $minfiles + $allowdropfiles))
+
+# Function to output formatted date
+dte()
+{
+echo -n $(date +%d/%m/%Y-%H:%M)
+}
+
+# Check a mirror
+chk_mirror()
+{
+echo &quot;Checking $1 ...&quot;
+rsync -rlptgoDhHSn \
+--stats \
+--delete-after \
+--delete-excluded \
+--protect-args \
+$myexcludes \
+&quot;$1&quot; \
+&quot;$mydestination&quot; &gt; $lockdir/cronsync_tmp_output
+status=$?
+files=$(cat $lockdir/cronsync_tmp_output | grep &quot;Number of files:&quot; | cut -d' ' -f4 )
+[[ $files -lt $minfiles ]] &amp;&amp; echo &quot;$(dte): Only $files/$actualfiles files in $1&quot; | tee -a $HOME/cronsync_error.log
+[[ $status &gt; 0 ]] &amp;&amp; echo &quot;$(dte): Error: $status while checking $1&quot; | tee -a $HOME/cronsync_error.log
+([[ $status = 0 ]] &amp;&amp; [[ $files -gt $minfiles ]]) || return 1
+# Save new minimum file count
+((minfiles = $files - $allowdropfiles))
+echo $minfiles &gt; $HOME/.cronsync
+return 0
+}
+
+# Loop through mirror list checking until one succeeds
+find_good_mirror()
+{
+for mirr in ${mymirrors[@]}; do
+chk_mirror $mirr &amp;&amp; { echo &quot;Found good mirror - $mirr&quot;; return 0; }
+done
+echo &quot;$(dte): Can't find a good mirror - aborting&quot; | tee -a $HOME/cronsync_error.log
+return 1
+}
+################### Main routine starts here
+# Avoid running two instances concurrently
+lockdir=/tmp/cronsync.lock
+if mkdir &quot;$lockdir&quot;; then
+trap 'rm -rf &quot;$lockdir&quot;' 0
+
+# Find a good mirror from the list (with files in it)
+find_good_mirror || exit 1
+
+# Live run with --max-delete set to 1000 just in case ;)
+echo &quot;Syncing from $mirr ...&quot;
+rsync -rlptgoDhHS \
+--progress \
+--stats \
+--delete-after \
+--max-delete=1000 \
+--delete-excluded \
+--protect-args \
+$myexcludes \
+&quot;$mirr&quot; \
+&quot;$mydestination&quot; | tee $HOME/cronsync_last.log
+status=${PIPESTATUS[0]}
+[[ $status = 0 ]] || { echo &quot;$(dte): Live run rsync error: $status&quot; &gt;&gt; $HOME/cronsync_error.log; exit 1; }
+echo &quot;Update complete&quot;
+else
+echo &quot;$(dte): cronsync already running or stale lock - skipping update - check /tmp/cronsync.lock&quot; &gt;&gt; $HOME/cronsync_error.log
+exit 0
+fi
+################### End of cronsync
+
+
+
+
+
+</PRE>
+
+
+<!--endarticle-->
+ <HR>
+ <P><UL>
+ <!--threads-->
+ <LI>Previous message: <A HREF="019732.html">[Mageia-dev] Distrib-coffee big failure of the century
+</A></li>
+ <LI>Next message: <A HREF="019782.html">[Mageia-dev] Barry's cronsync script - Bugs
+</A></li>
+ <LI> <B>Messages sorted by:</B>
+ <a href="date.html#19735">[ date ]</a>
+ <a href="thread.html#19735">[ thread ]</a>
+ <a href="subject.html#19735">[ subject ]</a>
+ <a href="author.html#19735">[ 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>