CVS和Bugzilla 数据备份脚本!
时间:2006-03-22 来源:hb_li_520
taraccount.sh
#!/bin/sh
bakhome=/home/cvsroot/account
file=account`date +%Y%m%d`.tar.gz
cd /home/cvsroot
tar zcvf $bakhome/$file /etc/passwd /etc/group /etc/shadow && echo "`date` accou
nt is backuped sucessfuly" > /tmp/account.tmp
cd $bakhome
ftp -n 192.168.0.254 <<-EOF
user ftpname ftppassword
cd /home/user/account
bin
put $file
ls
bye
EOF
echo "`date` account is ftp input sucessfuly " >> /tmp/account.tmp
ls -l $bakhome/$file >> /tmp/account.tmp
cat /tmp/account.tmp |mailto email1@XXXXXX.com,[email protected] -s 'acco
unt backup' tarcvs.sh #!/bin/sh
bakhome=/home/cvsroot/cvsbak
file=cvs`date +%Y%m%d`.tar.gz
cd /opt
tar -zcvf $bakhome/$file ./cvsroot && echo "`date` CVS is backuped sucessfuly" >
/tmp/cvsbak.tmp
#ls -l $bakhome/$file >> /tmp/cvsbak.tmp
cd $bakhome
ftp -n 192.168.0.254 <<-EOF
user ftpname ftppassword
cd /home/user/cvsbak
bin
put $file
ls
bye
EOF
echo "`date` CVS is ftp input sucessfuly " >> /tmp/cvsbak.tmp
ls -l $bakhome/$file >> /tmp/cvsbak.tmp
cat /tmp/cvsbak.tmp |mailto email1@XXXXXX.com,[email protected] -s 'cvs bac
kup'
bakhome=/home/cvsroot/account
file=account`date +%Y%m%d`.tar.gz
cd /home/cvsroot
tar zcvf $bakhome/$file /etc/passwd /etc/group /etc/shadow && echo "`date` accou
nt is backuped sucessfuly" > /tmp/account.tmp
cd $bakhome
ftp -n 192.168.0.254 <<-EOF
user ftpname ftppassword
cd /home/user/account
bin
put $file
ls
bye
EOF
echo "`date` account is ftp input sucessfuly " >> /tmp/account.tmp
ls -l $bakhome/$file >> /tmp/account.tmp
cat /tmp/account.tmp |mailto email1@XXXXXX.com,[email protected] -s 'acco
unt backup' tarcvs.sh #!/bin/sh
bakhome=/home/cvsroot/cvsbak
file=cvs`date +%Y%m%d`.tar.gz
cd /opt
tar -zcvf $bakhome/$file ./cvsroot && echo "`date` CVS is backuped sucessfuly" >
/tmp/cvsbak.tmp
#ls -l $bakhome/$file >> /tmp/cvsbak.tmp
cd $bakhome
ftp -n 192.168.0.254 <<-EOF
user ftpname ftppassword
cd /home/user/cvsbak
bin
put $file
ls
bye
EOF
echo "`date` CVS is ftp input sucessfuly " >> /tmp/cvsbak.tmp
ls -l $bakhome/$file >> /tmp/cvsbak.tmp
cat /tmp/cvsbak.tmp |mailto email1@XXXXXX.com,[email protected] -s 'cvs bac
kup'
n#!/bin/bash
nlogfile=/root/db.log
n/etc/init.d/mysql stop
nbakhome=/root/backup
nfile=mysql`date +%Y%m%d`.tar.gz
noldfile=/root/backup/mysql$(date +%Y%m%d --date='15 days ago').tar.gz
nls -l $oldfile >> $logfile
n# space
nif [ -f $oldfile ]
# 此处请注意一下[ ]两边要加空格
nthen
n rm -f $oldfile >> $logfile
n echo "[$oldfile] delete old file success!" >> $logfile
nelse
n echo "[$oldfile] no old backup file!" >> $logfile
nfi
n echo
ncd /home
ntar zcvf $bakhome/$file /var/lib/mysql && echo "`date` mysql is backuped sucessfuly" > /tmp/svndata.tmp
n/etc/init.d/mysql start
ncd $bakhome
nncftp -u svn -p svndata 172.16.0.203<<-EOF
ncd svndata
nbin
nput $file
nls
nbye
nEOF
necho "`date` mysql is ftp input sucessfuly " >> /tmp/svndata.tmp
nls -l $bakhome/$file >> /tmp/svndata.tmp