diff options
author | Nicolas Vigier <boklm@mageia.org> | 2013-04-14 13:46:12 +0000 |
---|---|---|
committer | Nicolas Vigier <boklm@mageia.org> | 2013-04-14 13:46:12 +0000 |
commit | 1be510f9529cb082f802408b472a77d074b394c0 (patch) | |
tree | b175f9d5fcb107576dabc768e7bd04d4a3e491a0 /zarb-ml/mageia-sysadm/attachments/20110222 | |
parent | fa5098cf210b23ab4f419913e28af7b1b07dafb2 (diff) | |
download | archives-1be510f9529cb082f802408b472a77d074b394c0.tar archives-1be510f9529cb082f802408b472a77d074b394c0.tar.gz archives-1be510f9529cb082f802408b472a77d074b394c0.tar.bz2 archives-1be510f9529cb082f802408b472a77d074b394c0.tar.xz archives-1be510f9529cb082f802408b472a77d074b394c0.zip |
Diffstat (limited to 'zarb-ml/mageia-sysadm/attachments/20110222')
-rw-r--r-- | zarb-ml/mageia-sysadm/attachments/20110222/189dccee/attachment-0001.sh | 82 | ||||
-rw-r--r-- | zarb-ml/mageia-sysadm/attachments/20110222/189dccee/attachment.sh | 82 |
2 files changed, 164 insertions, 0 deletions
diff --git a/zarb-ml/mageia-sysadm/attachments/20110222/189dccee/attachment-0001.sh b/zarb-ml/mageia-sysadm/attachments/20110222/189dccee/attachment-0001.sh new file mode 100644 index 000000000..b3db173b8 --- /dev/null +++ b/zarb-ml/mageia-sysadm/attachments/20110222/189dccee/attachment-0001.sh @@ -0,0 +1,82 @@ +#!/bin/bash +# +# Sample script template for setting up a Mageia mirror server. +# +# This script does the minimum tasks to rsync your local mirror +# from a Mageia source mirror. +# +# For that, please: +# * define LOCAL_MIRROR and SOURCE_MIRROR vars; +# * ideally, run this script every two hours for a public mirror. +# +# As soon as your mirror is ready, make sure to register it in our mirrors +# database on http://mirrors.mageia.org/new . +# +# For more information, see http://mirrors.mageia.org/ or join +# irc://irc.freenode.net/#mageia-sysadm +# + +# Path to your local mirror repository. +# You will need to dedicate about 700 GB. +# +LOCAL_MIRROR= + +# Remote rsync server you are using. +# +# * if your mirror is public, please use one of our Tier1 mirrors, listed on +# http://mirrors.mageia.org/?tier1 +# +# * if your mirror is for private/internal use, please use one of the Tier2 +# mirrors, listed on http://mirrors.mageia.org/?tier2 +# +SOURCE_MIRROR= + +# +RSYNC=`which rsync` + +# Please at least use the following options: +# --archive / -a (needed) +# --hard-links / -H (needed) +# --spare / -S (nice to have) +# --delete-after (nice to have) +# +# Please do not use compression and checksum options, to not overload +# remote server. +# +OPTIONS="-aHS --delete-after" + +# Lock file; makes sure we don't launch this script twice in a row. +# +LOCK_FILE=/tmp/mageia-mirror-rsync.lock + +if [ -z "$SOURCE_MIRROR" ]; then + echo "No source mirror defined." + exit 2 +fi + +if [ -z "$LOCAL_MIRROR" ]; then + echo "No local mirror defined." + exit 3 +fi + +if [ -f $LOCK_FILE ]; then + echo "$LOCK_FILE lock file found." + echo "=> A sync process is already running, no need to start another one." + exit 0 +fi + +echo $$ > $LOCK_FILE + +if [ ! -f $LOCK_FILE ]; then + echo "$LOCK_FILE not found... Please check that it can be created." + exit 1 +fi + +echo `date` +echo "Rsync'ing..." +$RSYNC $OPTIONS $SOURCE_MIRROR $LOCAL_MIRROR +echo "Done." +echo `date` +unlink $LOCK_FILE + +# Thank you!
\ No newline at end of file diff --git a/zarb-ml/mageia-sysadm/attachments/20110222/189dccee/attachment.sh b/zarb-ml/mageia-sysadm/attachments/20110222/189dccee/attachment.sh new file mode 100644 index 000000000..b3db173b8 --- /dev/null +++ b/zarb-ml/mageia-sysadm/attachments/20110222/189dccee/attachment.sh @@ -0,0 +1,82 @@ +#!/bin/bash +# +# Sample script template for setting up a Mageia mirror server. +# +# This script does the minimum tasks to rsync your local mirror +# from a Mageia source mirror. +# +# For that, please: +# * define LOCAL_MIRROR and SOURCE_MIRROR vars; +# * ideally, run this script every two hours for a public mirror. +# +# As soon as your mirror is ready, make sure to register it in our mirrors +# database on http://mirrors.mageia.org/new . +# +# For more information, see http://mirrors.mageia.org/ or join +# irc://irc.freenode.net/#mageia-sysadm +# + +# Path to your local mirror repository. +# You will need to dedicate about 700 GB. +# +LOCAL_MIRROR= + +# Remote rsync server you are using. +# +# * if your mirror is public, please use one of our Tier1 mirrors, listed on +# http://mirrors.mageia.org/?tier1 +# +# * if your mirror is for private/internal use, please use one of the Tier2 +# mirrors, listed on http://mirrors.mageia.org/?tier2 +# +SOURCE_MIRROR= + +# +RSYNC=`which rsync` + +# Please at least use the following options: +# --archive / -a (needed) +# --hard-links / -H (needed) +# --spare / -S (nice to have) +# --delete-after (nice to have) +# +# Please do not use compression and checksum options, to not overload +# remote server. +# +OPTIONS="-aHS --delete-after" + +# Lock file; makes sure we don't launch this script twice in a row. +# +LOCK_FILE=/tmp/mageia-mirror-rsync.lock + +if [ -z "$SOURCE_MIRROR" ]; then + echo "No source mirror defined." + exit 2 +fi + +if [ -z "$LOCAL_MIRROR" ]; then + echo "No local mirror defined." + exit 3 +fi + +if [ -f $LOCK_FILE ]; then + echo "$LOCK_FILE lock file found." + echo "=> A sync process is already running, no need to start another one." + exit 0 +fi + +echo $$ > $LOCK_FILE + +if [ ! -f $LOCK_FILE ]; then + echo "$LOCK_FILE not found... Please check that it can be created." + exit 1 +fi + +echo `date` +echo "Rsync'ing..." +$RSYNC $OPTIONS $SOURCE_MIRROR $LOCAL_MIRROR +echo "Done." +echo `date` +unlink $LOCK_FILE + +# Thank you!
\ No newline at end of file |