mkdir /var/qmailbakup
cd /var/qmailbakup
touch qmailbakup.sh
chmod 755 qmailbakup .sh
vi qmailbakup.sh
[code:1:d480555598]
#!/bin/sh
DATE=`date +%Y-%m-%d-%H`
cd /var/qmailbakup/
tar cvzf domains.$DATE.tar.gz /home/vpopmail/domains
tar cvzf control.$DATE.tar.gz /var/qmail/control
tar cvzf mysql.$DATE.tar.gz /usr/local/mysql/var
ftp -n 192.168.0.21 << ! //你的ftp服务器的地址
user qmail qmailbakup //ftp用户名和密码,注意要有put权限
binary
put domains.$DATE.tar.gz
put control.$DATE.tar.gz
put mysql.$DATE.tar.gz
bye
!