...........
buzz 发表于 2016-5-23 12:45
xxx=$(/usr/bin/lftp -u root,password sftp://123.123.123.123 -e "pget -n 30 /root/ubuntu-16.04-server ...
试了
xxx=`/usr/bin/lftp -u root,password sftp://123.123.123.123 -e "pget -n 30 /root/ubuntu-16.04-server-amd64.template;exit"` 本帖最后由 zyypp 于 2016-5-23 22:45 编辑
这样子呢
[*]/usr/bin/lftp -c 'get sftp://用户名:密码@IP:端口/root/ubuntu-16.04-server-amd64.template'复制代码
[*]/usr/bin/lftp -c 'pget -n 30 sftp://用户名:密码@IP:端口/root/ubuntu-16.04-server-amd64.template'
[*]复制代码
用time命令看 get 比pget分块后 速度快些 不知是否错觉~~ 看9楼 脚本里
[*]date >> /root/test.txt
[*]/usr/bin/lftp -u root,password sftp://123.123.123.123 -e "pget -n 30 /root/ubuntu-16.04-server-amd64.template;exit" >> /root/test.txt[/code]
[*]重定向去掉
[*]echo date;
[*]/usr/bin/lftp -u root,password sftp://123.123.123.123 -e "pget -n 30 /root/ubuntu-16.04-server-amd64.template;exit" 复制代码
然后sh 这个脚本看下输出 没问题 最后再重定向到txt
Zeraba 发表于 2016-5-23 21:58
看9楼 脚本里
然后sh 这个脚本看下输出 没问题 最后再重定向到txt
我原来脚本sh都没问题的。只是放到crontab就不行。 crontab里面都被你定向到null了,哪来的记录。
修改成下面
[*]*/5 * * * * sh /root/test.sh复制代码 cron里这样执行
*/5 * * * * root sh /root/test.sh
页:
1
[2]