【问题标题】:Rsync failing with Env VariableRsync 因环境变量而失败
【发布时间】:2013-04-01 19:05:00
【问题描述】:

我正在使用以下脚本来同步回文件。如果我在 shell 上一一执行,它就可以工作。但是当我用在脚本中执行它们时,它给出了错误

"rsync: link_stat "/home/tan/testnfs#015" failed: No such file or directory (2)"

015 不在脚本中,我已经编辑了脚本并确认没有空格或字符留下。但是有同样的问题。

#!/bin/bash
#========================================
#Environment varibale settings
#========================================
username=test
codedir=/home/tan/testnfs
nfs=10.100.200.4::test
adminemail=backup@tan.com
errorlog=/home/tan/backuperror_log.txt
dat=$(date)
rm -fr $errorlog
echo $dat 2>&1>> $errorlog
echo $nfsserver
echo ========== Before rsync =================
rsync --stats -vr --exclude "*.png" --exclude "*.jpg" --exclude "*.jpeg" --exclude "*.zip" --exclude "*.pdf" --exclude "*.doc" --exclude "*.csv" --exclude "*.swf" $codedir $nfs
if [ $? = 0 ] then
mail -s "$username sync--complete" $adminemail < $errorlog
else
mail -s "$username sync--Incomplete" $adminemail < $errorlog
fi

【问题讨论】:

  • 我已经弄清楚了。我在 Windows 上编辑脚本,它正在添加它的行终止符。我用记事本++将它保存为linux文件,它工作了

标签: rsync env


【解决方案1】:

我已经弄清楚了。我在 Windows 上编辑脚本,它正在添加它的行终止符。我已经用记事本++将它保存为linux文件并且它工作了

【讨论】:

    猜你喜欢
    • 2020-11-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-03
    • 2019-09-01
    • 1970-01-01
    • 2018-04-23
    • 1970-01-01
    相关资源
    最近更新 更多