我在本地linux上做了一个脚本:
#!/bin/bash
SYNC_LOG='/var/log/rsync_tokyo_app.log'
CUR_TIME=`date +%Y.%m.%d.%H:%M:%S`
#1 setp: svn update app source
#/usr/bin/svn update --username fancy --password Jzr004242% /var/www/mi1 \
# > $SYNC_LOG && echo "$CUR_TIME svnupdate success!" >> $SYNC_LOG
#2 setp: app rsync
rsync -varzoe 'ssh -i /root/.ssh/Fancy.pub' --progress --delete \
--exclude 'database.ini'\
--exclude 'monkey.conf'\
--exclude 'datamapper.yml'\
--exclude 'redis.yml' \
/var/www/mi1/ fancy@ip:/var/www/mi1 >> $SYNC_LOG && \
echo "$CUR_TIME rsyncapp success!" >> $SYNC_LOG
~
此脚本内容是用来做远程同步的(说白了就是把本地机器上的一台web server上的/var/www/mi1下的内容传到远程(例如国外的web server上)),平时都运行得好好的哦,今天出错了:报错如下:
rsync: failed to set times on "/var/www/mi1/lib/mor_support/.svn/prop-base": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/lib/mor_support/.svn/props": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/lib/mor_support/.svn/text-base": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/lib/mor_support/.svn/tmp": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/lib/mor_support/.svn/tmp/prop-base": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/lib/mor_support/.svn/tmp/props": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/lib/mor_support/.svn/tmp/text-base": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/logs": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/public": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/public/.svn": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/public/.svn/prop-base": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/public/.svn/props": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/public/.svn/text-base": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/public/.svn/tmp": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/public/.svn/tmp/prop-base": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/public/.svn/tmp/props": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/public/.svn/tmp/text-base": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/test": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/test/.svn": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/test/.svn/prop-base": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/test/.svn/props": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/test/.svn/text-base": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/test/.svn/tmp": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/test/.svn/tmp/prop-base": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/test/.svn/tmp/props": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/test/.svn/tmp/text-base": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/test/unit": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/test/unit/.svn": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/test/unit/.svn/prop-base": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/test/unit/.svn/props": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/test/unit/.svn/text-base": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/test/unit/.svn/tmp": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/test/unit/.svn/tmp/prop-base": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/test/unit/.svn/tmp/props": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/test/unit/.svn/tmp/text-base": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/test/unit/mor_dispatch": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/test/unit/mor_dispatch/.svn": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/test/unit/mor_dispatch/.svn/prop-base": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/test/unit/mor_dispatch/.svn/props": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/test/unit/mor_dispatch/.svn/text-base": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/test/unit/mor_dispatch/.svn/tmp": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/test/unit/mor_dispatch/.svn/tmp/prop-base": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/test/unit/mor_dispatch/.svn/tmp/props": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/test/unit/mor_dispatch/.svn/tmp/text-base": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/test/unit/mor_record": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/test/unit/mor_record/.svn": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/test/unit/mor_record/.svn/prop-base": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/test/unit/mor_record/.svn/props": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/test/unit/mor_record/.svn/text-base": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/test/unit/mor_record/.svn/tmp": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/test/unit/mor_record/.svn/tmp/prop-base": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/test/unit/mor_record/.svn/tmp/props": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/test/unit/mor_record/.svn/tmp/text-base": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/tmp": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/tmp/.svn": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/tmp/.svn/prop-base": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/tmp/.svn/props": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/tmp/.svn/text-base": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/tmp/.svn/tmp": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/tmp/.svn/tmp/prop-base": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/tmp/.svn/tmp/props": Operation not permitted (1)
rsync: failed to set times on "/var/www/mi1/tmp/.svn/tmp/text-base": Operation not permitted (1)
rsync: mkstemp "/var/www/mi1/app/.svn/.entries.Pu8QlN" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/app/controllers/.application_controller.rb.BsQhJ7" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/app/controllers/.svn/.entries.7d2I6r" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/app/controllers/.svn/text-base/.application_controller.rb.svn-base.5J2auM" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/app/helpers/.svn/.entries.HeaER6" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/app/models/.ad_history.rb.LXzQfr" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/app/models/.consumer.rb.1ol3DL" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/app/models/.country2city.rb.xWxg25" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/app/models/.customer.rb.VJauqq" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/app/models/.device.rb.PJdIOK" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/app/models/.histroy.rb.3jIWc5" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/app/models/.login.rb.X5BbBp" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/app/models/.prom.rb.vKPqZJ" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/app/models/.svn/.entries.BCPGn4" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/app/models/.svn/prop-base/.ad_history.rb.svn-base.9MLXLo" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/app/models/.svn/prop-base/.country2city.rb.svn-base.FW7eaJ" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/app/models/.svn/prop-base/.login.rb.svn-base.TqNwy3" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/app/models/.svn/text-base/.ad_history.rb.svn-base.nn9WWn" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/app/models/.svn/text-base/.consumer.rb.svn-base.zGrolI" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/app/models/.svn/text-base/.country2city.rb.svn-base.LLmQJ2" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/app/models/.svn/text-base/.customer.rb.svn-base.DuHi8m" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/app/models/.svn/text-base/.device.rb.svn-base.tQsLwH" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/app/models/.svn/text-base/.histroy.rb.svn-base.JFEeV1" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/app/models/.svn/text-base/.login.rb.svn-base.zL9Hjm" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/app/models/.svn/text-base/.prom.rb.svn-base.db4bIG" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/app/record_ext/.allfish.rb.xSq3d1" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/app/record_ext/.chkin.rb.1cXVJl" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/app/record_ext/.chkin_accessor.rb.tmUOfG" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/app/record_ext/.chkin_confirm.rb.hjhIL0" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/app/record_ext/.prom_accessor.rb.Hz4Bhl" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/app/record_ext/.prom_getted.rb.Nz2vNF" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/app/record_ext/.prom_getting.rb.Djsqj0" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/app/record_ext/.svn/.entries.ngOlPk" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/app/record_ext/.svn/text-base/.allfish.rb.svn-base.RqPKxF" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/app/record_ext/.svn/text-base/.chkin.rb.svn-base.9WCag0" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/app/record_ext/.svn/text-base/.chkin_accessor.rb.svn-base.h4PAYk" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/app/record_ext/.svn/text-base/.chkin_confirm.rb.svn-base.bKs1GF" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/app/record_ext/.svn/text-base/.prom_accessor.rb.svn-base.1dusp0" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/app/record_ext/.svn/text-base/.prom_getted.rb.svn-base.FBVT7k" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/app/record_ext/.svn/text-base/.prom_getting.rb.svn-base.3EwlQF" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/config/.application.rb.j237y0" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/config/.environment.rb.p6XUhl" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/config/.route.rb.5EkI0F" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/config/.rv_mapper.yml.BO6vJ0" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/config/.svn/.entries.LQEksl" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/config/.svn/text-base/.application.rb.svn-base.ZgGhbG" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/config/.svn/text-base/.datamapper.yml.svn-base.TodfU0" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/config/.svn/text-base/.environment.rb.svn-base.NYadDl" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/config/.svn/text-base/.monkey.conf.svn-base.xBybmG" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/config/.svn/text-base/.redis.yml.svn-base.D7ma50" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/config/.svn/text-base/.route.rb.svn-base.DaC9Nl" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/config/.svn/text-base/.rv_mapper.yml.svn-base.x8h9wG" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/.monkey.rb.3VK9f1" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/.mor_dispatch.rb.toCaZl" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/.mor_exception.rb.fUVbIG" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/.mor_marco.rb.fhrdr1" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/.mor_record.rb.tBnfam" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/.mor_section.rb.RwMhTG" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/.mor_support.rb.5MwkC1" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/.svn/.entries.zrPnlm" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/.svn/text-base/.monkey.rb.svn-base.NJKg5G" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/.svn/text-base/.mor_dispatch.rb.svn-base.TDnaP1" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/.svn/text-base/.mor_exception.rb.svn-base.1Oq4ym" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/.svn/text-base/.mor_marco.rb.svn-base.rrTYiH" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/.svn/text-base/.mor_record.rb.svn-base.hzvT21" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/.svn/text-base/.mor_section.rb.svn-base.NkNOMm" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/.svn/text-base/.mor_support.rb.svn-base.NdrKwH" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/monkey/.application.rb.LjSGg2" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/monkey/.config.rb.TYID0m" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/monkey/.logger.rb.DD7AKH" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/monkey/.svn/.entries.DW4yu2" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/monkey/.svn/prop-base/.logger.rb.svn-base.j5Fxen" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/monkey/.svn/text-base/.application.rb.svn-base.3HzyYH" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/monkey/.svn/text-base/.config.rb.svn-base.DVSzI2" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/monkey/.svn/text-base/.logger.rb.svn-base.dHnBsn" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/mor_dispatch/.controller.rb.TJXDcI" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/mor_dispatch/.route.rb.thJGW2" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/mor_dispatch/.session.rb.7eXJGn" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/mor_dispatch/.svn/.entries.dvLNqI" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/mor_dispatch/.svn/text-base/.controller.rb.svn-base.p0Z4g3" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/mor_dispatch/.svn/text-base/.route.rb.svn-base.LYQm7n" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/mor_dispatch/.svn/text-base/.session.rb.svn-base.Dp8EXI" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/mor_exception/.rv_mapper.yml.9cfYN3" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/mor_exception/.svn/.entries.LrShEo" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/mor_exception/.svn/text-base/.rv_mapper.yml.svn-base.h59OuJ" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/mor_record/.adapter.rb.z1cnl4" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/mor_record/.pg_adapter.rb.PUCVbp" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/mor_record/.pg_result_ext.rb.hKvu2J" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/mor_record/.svn/.entries.FPX3S4" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/mor_record/.svn/text-base/.adapter.rb.svn-base.D1fkUp" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/mor_record/.svn/text-base/.pg_adapter.rb.svn-base.fkdBVK" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/mor_record/.svn/text-base/.pg_result_ext.rb.svn-base.dYzSW5" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/mor_section/.component.rb.5w3m0q" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/mor_section/.element.rb.ViSR3L" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/mor_section/.load.rb.5k6m76" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/mor_section/.upload.rb.LPMSas" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/mor_section/.svn/.entries.lD0oeN" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/mor_section/.svn/prop-base/.load.rb.svn-base.FA7Vh8" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/mor_section/.svn/text-base/.component.rb.svn-base.DeStlt" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/mor_section/.svn/text-base/.element.rb.svn-base.XZY1oO" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/mor_section/.svn/text-base/.load.rb.svn-base.VHvAs9" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/mor_section/.svn/text-base/.upload.rb.svn-base.TJs9vu" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/mor_support/.inifile.rb.7dckAP" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/mor_support/.svn/.entries.leIvEa" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/lib/mor_support/.svn/text-base/.inifile.rb.svn-base.nK1HIv" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/public/.svn/.entries.fjfVMQ" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/test/.svn/.entries.F7RBRb" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/test/unit/.svn/.entries.9NPvWw" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/test/unit/mor_dispatch/.route.rb.lj2q1R" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/test/unit/mor_dispatch/.svn/.entries.ls2m6c" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/test/unit/mor_dispatch/.svn/text-base/.route.rb.svn-base.j4Pjby" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/test/unit/mor_record/.adapter.rb.rhYVgT" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/test/unit/mor_record/.svn/.entries.Rx5yme" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/test/unit/mor_record/.svn/text-base/.adapter.rb.svn-base.F40csz" failed: Permission denied (13)
rsync: mkstemp "/var/www/mi1/tmp/.svn/.entries.z0BRDU" failed: Permission denied (13)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1042) [sender=3.0.7]
[root@apptest www]#
root cause:
1,因为权限的问题(2.33是用账号“fancy”来更新aws_jp的,所以在更新的时候需要检查aws_jp下的/var/www/mi1的权限,
命令为: chown -R fancy mi1/;
2, app1是用账号ec2-user来更新aws_sg的,所以在更新aws_sg的时候同样得更改/var/www/mi 的权限,否则报错!!)
3, 改过权限之后,为了不至于会产生后患,还必须把原来的权限都改回来。