Hi! I am now mirroring CentOS and I would like to use lock files so that I don't start multiple connections at the same time. I don't know how to do this... The CentOS Mirroring HowTo 'told' me that this mailing list can help me! Thank you in advance...
Silvian Cretu ----------------- http://www.linux360.ro/ http://toxic-chat.sourceforge.net/ http://www.caramida-verde.as.ro/
__________________________________ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com
Hi,
easiest way to prevent doubles is checking the process list. E.G. create a bash-script for your mirroring, that checks if there is already a connection to msync.centos.org::CentOS
---- SNIP ---- #!/bin/bash
if [ "$(ps auxw|grep msync.centos.org::CentOS|grep -v grep" != "" ];then echo "A centos-sync is already running ..." exit fi rsync -aqzH --delete msync.centos.org::CentOS /PATH/TO/YOUR/MIRROR/FILES/ ---- SNAP ----
Kind regards Jens
Silvian Cretu wrote:
Hi! I am now mirroring CentOS and I would like to use lock files so that I don't start multiple connections at the same time. I don't know how to do this... The CentOS Mirroring HowTo 'told' me that this mailing list can help me! Thank you in advance...
Silvian Cretu
http://www.linux360.ro/ http://toxic-chat.sourceforge.net/ http://www.caramida-verde.as.ro/
__________________________________ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com _______________________________________________ CentOS-mirror mailing list CentOS-mirror@centos.org http://lists.centos.org/mailman/listinfo/centos-mirror
Thank you! It works fine and it is, by far, the easiest way (I've google for others so...) to do what I wanted...
--- Mirror-Admin intergenia AG mirrors@intergenia.de wrote:
Hi,
easiest way to prevent doubles is checking the process list. E.G. create a bash-script for your mirroring, that checks if there is already a connection to msync.centos.org::CentOS
---- SNIP ---- #!/bin/bash
if [ "$(ps auxw|grep msync.centos.org::CentOS|grep -v grep" != "" ];then echo "A centos-sync is already running ..." exit fi rsync -aqzH --delete msync.centos.org::CentOS /PATH/TO/YOUR/MIRROR/FILES/ ---- SNAP ----
Kind regards Jens
Silvian Cretu wrote:
Hi! I am now mirroring CentOS and I would like to
use
lock files so that I don't start multiple
connections
at the same time. I don't know how to do this... The CentOS Mirroring HowTo 'told' me that this
mailing
list can help me! Thank you in advance...
Silvian Cretu
http://www.linux360.ro/ http://toxic-chat.sourceforge.net/ http://www.caramida-verde.as.ro/
__________________________________ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com _______________________________________________ CentOS-mirror mailing list CentOS-mirror@centos.org
http://lists.centos.org/mailman/listinfo/centos-mirror
CentOS-mirror mailing list CentOS-mirror@centos.org
http://lists.centos.org/mailman/listinfo/centos-mirror
Silvian Cretu ----------------- http://www.linux360.ro/ http://toxic-chat.sourceforge.net/ http://www.caramida-verde.as.ro/
__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
On Tuesday 13 September 2005 12:30, Mirror-Admin intergenia AG wrote:
Hi,
easiest way to prevent doubles is checking the process list. E.G. create a bash-script for your mirroring, that checks if there is already a connection to msync.centos.org::CentOS
---- SNIP ---- #!/bin/bash
if [ "$(ps auxw|grep msync.centos.org::CentOS|grep -v grep" != "" ];then
A better condition would be:
pgrep -f "rsync -options msync.centos.org ..." >/dev/null if [ $? -eq 1 ]; then echo "You should start the mirror, no sync in progress" else echo "Another sync is in progress" fi
...but this is begining to be a shell programming issue more than a mirror-setup thingie.
Mihai
Hi!
Please remove my server from CentOS mirror list:
http://ftp.siiludus.com/pub/centos/ ftp://ftp.siiludus.com/pub/centos/ rsync.siiludus.com::centos
I'm gonna change my working place soon and can't keep it up.
Andres Lippur
A simular question was asked a while back, here was my reply...
-------------------------------------------------------------------------------------------------------- Here's my rsync script, kind of a quick write so it could be better.. One thing some of you might like is that the script checks to make sure that the process is actually running if the pid file exists. If the pid file exists but the process doesnt, it clears the pid and continues...
Note: the script has be to run as root to write the pid, other wise you'll need to make a dir in /var/run and chown that dir, chown it to your user and edit the script to use that dir...
--------------[CODE]---------------- #!/bin/sh RSYNC="/usr/bin/rsync" RSYNC_OPTS="-aHv --delete --bwlimit=512 "
if [ -f "/var/run/mirror.pid" ]; then RUNPID=`cat /var/run/mirror.pid` if ps -p $RUNPID; then echo "Mirror is already running..." exit 1 else echo "Mirror pid found but process dead, cleaning up" rm -f /var/run/mirror.pid fi else echo "No Mirror Process Detected" fi echo $$ > /var/run/mirror.pid
echo -n "Mirror Started at " date
#CentOS Mirror $RSYNC $RSYNC_OPTS rsync://mirror.centos.org/cAos/centos/ /data/mirrors/centos/
echo -n "Mirror Ended at " date rm -f /var/run/mirror.pid ----------------------------------------------------------------------------------------------------------------------------------------
Best Regards,
Shaun Reitan Account Specialist www.NDCHost.com www.cPlicensing.net
Yes, I read this reply, but it seemed too complicated... The answer I received yesterday gave me an easier way, and it's working!
--- Shaun ml@ndchost.com wrote:
A simular question was asked a while back, here was my reply...
--------------------------------------------------------------------------------------------------------
Here's my rsync script, kind of a quick write so it could be better.. One thing some of you might like is that the script checks to make sure that the process is actually running if the pid file exists. If the pid file exists but the process doesnt, it clears the pid and continues...
Note: the script has be to run as root to write the pid, other wise you'll need to make a dir in /var/run and chown that dir, chown it to your user and edit the script to use that dir...
--------------[CODE]---------------- #!/bin/sh RSYNC="/usr/bin/rsync" RSYNC_OPTS="-aHv --delete --bwlimit=512 "
if [ -f "/var/run/mirror.pid" ]; then RUNPID=`cat /var/run/mirror.pid` if ps -p $RUNPID; then echo "Mirror is already running..." exit 1 else echo "Mirror pid found but process dead, cleaning up" rm -f /var/run/mirror.pid fi else echo "No Mirror Process Detected" fi echo $$ > /var/run/mirror.pid
echo -n "Mirror Started at " date
#CentOS Mirror $RSYNC $RSYNC_OPTS rsync://mirror.centos.org/cAos/centos/ /data/mirrors/centos/
echo -n "Mirror Ended at " date rm -f /var/run/mirror.pid
----------------------------------------------------------------------------------------------------------------------------------------
Best Regards,
Shaun Reitan Account Specialist www.NDCHost.com www.cPlicensing.net
CentOS-mirror mailing list CentOS-mirror@centos.org
http://lists.centos.org/mailman/listinfo/centos-mirror
Silvian Cretu ----------------- http://www.linux360.ro/ http://toxic-chat.sourceforge.net/ http://www.caramida-verde.as.ro/
__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com