首页 > 代码库 > 备份windows共享最近一天文件
备份windows共享最近一天文件
#!/bin/bash
src=http://www.mamicode.com/root/server/ic/
dst=/var/server_data/ic/
dateTime=`date +%Y%m%d-%H:%M`
mount -t cifs -o username=everyone,password="" //192.168.7.192/ic-bak$ $src
Backup () {
newFile=`ls -At $src |head -n 1` > /tmp/ic.src
if [ -z "$newFile" ];
then
echo "IC-bak Null" |mail -s "IC-bka Null!" 111111@sina.com
else
\cp -a $src$newFile $dst
File=`ls -At $dst |head -n 1` > /tmp/ic.dst
diff /tmp/ic.src /tmp/ic.dst
if [ $? -eq 0 ];
then
echo "$dateTime $File OK" >> /root/log/ic.log
else
echo "$dateTime $File Fail" >> /root/log/ic.log
fi
fi
rm -f /tmp/ic.*
}
Backup
umount $src
本文出自 “Shell” 博客,请务必保留此出处http://zhizhimao.blog.51cto.com/3379994/1930945
备份windows共享最近一天文件