-   Linux - Server (
-   -   Frustrating RSYNC issue setting up CentOS mirror (

Maeltor 03-04-2008 09: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.



# 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

clean () {
      rm -fr ${lock}

trap clean 0

rsync -aqHz --delete --delay-updates --exclude '/2*' --exclude '/3*' /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 10:06 PM

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

rsync -a --no-o ...

Maeltor 03-04-2008 10: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


rsync -aqHz --no-o --no-g --delete --delay-updates --exclude '/2*' --exclude '/3*' /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 10:52 PM

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


Berhanie 03-04-2008 11:30 PM

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 11:44 AM.