周六,事情不多,把一直以来的担心事给做了:几台Linux Server都是单硬盘,没有RAID,就让他们相互之间做个备份吧。
以下只摘录adsl server备份的脚本吧,其它几台都是照抄,只是实现功能部分加减而已,然后再让它每月一号的凌晨五点开始备份。
#crontab -e
#M:minute(0-59),H:hour(0-23),D:day(1-31),m:month(1-12),d:day of week(0-6)
# Backup mail server
0 5 1 * * root /home/wht/backup/backupmail.sh
#backupadsl.sh #!/bin/bash
#系统主要的服务有:
# (1)Squid
# (2)NAT
# (3)VSftp
# (4)Sshd
# (5)Other
#设置基本路径
backdate=adsl-`date +%Y%m%d`
basedir=/home/wht/backup/adsl
natd=$basedir/nat
squidd=$basedir/squid
etcd=$basedir/etc
#Squid
cp -a -f /etc/squid/* $squidd
#NAT
cp -a -f /usr/local/nat/* $natd
#Vsftpd
cp -f /etc/vsftpd/vsftpd.conf $etcd
#etc
cp -f /etc/resolv.conf $etcd
cp -f /etc/rc.d/rc.local $etcd
cp -f /etc/crontab $etcd
cp -f /etc/group* $etcd
cp -f /etc/gshadow* $etcd
cp -f /etc/host.conf $etcd
cp -f /etc/hosts $etcd
cp -f /etc/hosts.allow $etcd
cp -f /etc/hosts.deny $etcd
cp -f /etc/passwd* $etcd
cp -f /etc/shadow* $etcd
cp -f /etc/sysconfig/i18n $etcd
cp -f /etc/sysconfig/network $etcd
cp -f /etc/sysconfig/network-scripts/ifcfg-eth0 $etcd
#SSH
cp -f /etc/ssh/ssh_config $etcd
#Start Backup
cd /home/wht/backup
tar -zpcf $backdate.tar.gz ./adsl/*
sleep 3s
sync;sync;sync
#FTP到另一台Server
id="wht"
pw='xxxxxx'
cd /home/wht/backup
ftp -n 172.16.86.5 >>$basedir.ftp.log 2>&1 <<EOF
user $id $pw
bin
cd backup/adsl
put $backdate.tar.gz
bye
EOF
#FTP to 172.16.86.1
ftp -n 172.16.86.1 >>$basedir.ftp.log 2>&1 <<EOF
user $id $pw
bin
cd backup/adsl
put $backdate.tar.gz
bye
EOF
sync;sync
|
还有一个海关系统的1U Server ,晕,竟然也没有做RAID,够胆大的了,也将之数据库每天备份到一台专用做备份的SERVER上面去吧,
用Windows的计划任务定时每天凌晨三点执行就可以了
backup-edi.bat
@echo off
rem set d=%date:~5,2%-%date:~8,2%-%date:~0,4%
net use u: /delete
net use u: \\dbbackup.com\db$\edi umecdaemon /user:umec\backdb
rem Backup edi-sql server
rem -df:delete behind compress -o+:overlay
rar a -agYYYYMMDDHHMM -df -o+ d:\backup\bak-edi\ECustoms-db- d:\backup\edi-backup\
xcopy /D /C d:\backup\bak-edi\*.* u:\
rem Backup edi-access
rar a -agYYYYMMDDHHMM -o+ u:\pusa80- d:\custom\cust2000\pusa80.mdb
net use u: /delete
echo on
exit
|
阅读(1453) | 评论(0) | 转发(0) |