写了一个传递FTP的脚本,但是有点问题,请各位兄弟指点一二
时间:2011-02-24
来源:互联网
已经建立了信任,不需要使用密码就能从A服务器直接登录 192.168.1.2,环境是SOLARIS 10
ssh2 gspnd@prodoracle
Authentication successful.
Last login: Thu Feb 24 06:56:41 2011 from 192.168.1.2
下面就是脚本
cat file.sh
#!/usr/bin/ksh
function init {
logon=$1;shift
file_list=$*
}
function put_file {
bf=$1;
log=$2;
(/usr/local/bin/sftp2 -B $bf $logon) > $log 2>&1 &
}
function main {
for bf in $file_list
do
if [ -f $bf ]; then
log=${bf}.log
touch $log
if [ $? -gt 0 ];then
error "Cannot create log file $log. The output will be discarded."
log=/dev/null
fi
put_file $bf $log
else
error "$bf not exists. Please check and run again."
fi
done
}
init $*
main;
下面就是要传递文件德内容
cat put_back.txt
cd /backup/PROD
lcd /backup/UAT
mput *
quit
运行传递
./file.sh gspnd@prodoracle putback.txt
[1] 24320
但是发现文件没有被传走,在当前机器下酒产生了一个空白日志
put_back.txt.log
ssh2 gspnd@prodoracle
Authentication successful.
Last login: Thu Feb 24 06:56:41 2011 from 192.168.1.2
下面就是脚本
cat file.sh
#!/usr/bin/ksh
function init {
logon=$1;shift
file_list=$*
}
function put_file {
bf=$1;
log=$2;
(/usr/local/bin/sftp2 -B $bf $logon) > $log 2>&1 &
}
function main {
for bf in $file_list
do
if [ -f $bf ]; then
log=${bf}.log
touch $log
if [ $? -gt 0 ];then
error "Cannot create log file $log. The output will be discarded."
log=/dev/null
fi
put_file $bf $log
else
error "$bf not exists. Please check and run again."
fi
done
}
init $*
main;
下面就是要传递文件德内容
cat put_back.txt
cd /backup/PROD
lcd /backup/UAT
mput *
quit
运行传递
./file.sh gspnd@prodoracle putback.txt
[1] 24320
但是发现文件没有被传走,在当前机器下酒产生了一个空白日志
put_back.txt.log
作者: 零七年的夏天 发布时间: 2011-02-24
UP
作者: 零七年的夏天 发布时间: 2011-02-25
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28