备份文件并上传到邮箱

sh/bash/dash/ksh/zsh等Shell脚本
回复
beruchtigte
帖子: 284
注册时间: 2007-12-30 13:17

备份文件并上传到邮箱

#1

帖子 beruchtigte » 2009-08-17 11:14

渴望达到dropbox的效果 但是总是看到它在那里同步 心里很不爽

思路 1 建立一个文件夹 (我是 ~/backup)
2 把欲备份文件复制到此文件夹中
3 将该文件夹内文件打包 (我用7z 压缩包文件名用日期 )
4 上传至邮箱 (利用mutt发附件)
=========================this is the beginning of divider================
7z a `date -d today +"%Y-%m-%d-%H"`.7z ~/backup
echo `date` | mutt -a `date -d today +"%Y-%m-%d-%H"`.7z -s "备份"`date -d today +"%Y-%m-%d-%H:%M:%S"` xxxxxx@gmail.com
echo "files sent......."
wait
rm `date -d today +"%Y-%m-%d-%H"`.7z
echo "7z-file cleaned "
====================================this is the end of divider================

我写的非常烂 因为我还不懂 不过可以用了
回复