利用任务自动上传备份。

#!/bin/bash
rq=`date +%F%H%M`
ct=`netstat -an | grep xxxxx | wc`
localip=`/sbin/ifconfig eth0 | awk ‘/inet/{print $2; exit }’ | cut -d: -f2`

echo “$rq $ct” >> /home/tool/tmp.txt
/usr/bin/tac /home/tool/tmp.txt > $localip.txt
ftp -v -n 1.1.1.1 << EOF
user tlbb tlbb
binary
hash
lcd /home/tool
put $localip.txt
close
bye
EOF
原文地址:https://www.cnblogs.com/dieangel/p/3327014.html