LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (http://www.linuxquestions.org/questions/linux-server-73/)
-   -   Frustrating RSYNC issue setting up CentOS mirror (http://www.linuxquestions.org/questions/linux-server-73/frustrating-rsync-issue-setting-up-centos-mirror-625761/)

Maeltor 03-04-2008 10:21 PM

Frustrating RSYNC issue setting up CentOS mirror
 
Ok, I am having the most absolute horribly frustrating time setting up a CentOS mirror.
I have initiated an rsync script and cron job however and the script works, however its writing the files with seemingly random owners and groups.

Code:

#!/bin/sh

# please adjust
lock=~/`basename ${0}`.lock

if [ -f ${lock} ]; then
      # This ensure script didn't die w/o removing lock
      # Ex: power failure
      [ -d /proc/`cat ${lock}` ] && exit 0
fi

clean () {
      rm -fr ${lock}
}

trap clean 0

rsync -aqHz --delete --delay-updates --exclude '/2*' --exclude '/3*' us-msync.centos.org::CentOS /var/www/centos

I am running the script as root, why is it NOT writing the files as root to my local server?
It is writing the files as mysql:mysql sometimes and jeremyv:nagioscmd othertimes. Any ideas?

I am running CentOS 5.0

Berhanie 03-04-2008 11:06 PM

The '-a' implies '-o', which preserves owner. If you want '-a' except for '-o', you can do
Code:

rsync -a --no-o ...

Maeltor 03-04-2008 11:48 PM

Ok so to understand this a bit better.
Is it trying to preserve the owner and group from the master rsync server? If that is the case how is it pulling user/group that I have on my local system (like mysql and jeremyv)? Is that because it is preserving by userid and groupid?

If so I will modify my script to read

Code:

rsync -aqHz --no-o --no-g --delete --delay-updates --exclude '/2*' --exclude '/3*' us-msync.centos.org::CentOS /var/www/centos
If I am understanding this correctly, that will write the files to my local server as root:root right?

Maeltor 03-04-2008 11:52 PM

It would appear that worked, looks like it is writing the files as root:root now.

Thanks

Berhanie 03-05-2008 12:30 AM

Ownership is preserved by owner name. When the name isn't present on the target, the uid (number) is preserved instead. That uid may already correspond to some user on the target, which can lead to unexpected results. This behavior can be changed with --numeric-ids.


All times are GMT -5. The time now is 04:03 AM.