转移mailman

Posted on 七月 3rd, 2007 in Linux | 3 Comments »

mailman所在服务器的硬盘损坏,需要转移到另外一个服务器上。
需要备份的目录:/var/lib/mailman/
在新服务器上搭建好mailman环境后,拷贝原服务器上的archives,lists,data三个目录下的所有内容。
之后:

sudo chown -R list:list /var/lib/mailman

在继续搭建mailman的WEB环境之后,就可以测试了。

完整备份evolution

Posted on 八月 23rd, 2006 in Linux | 2 Comments »

一直以为只要备份了~/.evolution目录,就可以保证evoultuion里的信息才不丢失。今天才发现是错误的,这样只能保证邮件不丢,其他的如联系人、备忘、日历等都会丢失的。
下面是在ubuntuforums搜索到的信息:

I've answered this question before, so I've been reluctant to jump into this thread...

To fully backup and restore Evolution data, including signatures, email account configuration, etc, you need to backup the following files and directories:

--directories--
1) ~/.evolution
2) ~/.gconf/apps/evolution

--files--
3) ~/.gnome2_private/Evolution

To restore the files, run Evolution on the new machine and complete the first run wizard. Then shut down Evolution and copy the backup files to their appropriate locations. Reboot the machine or stop/restart the Evolution data server (important step). When you launch Evolution after these steps your email, contacts, tasks, and settings will be restored. As harryc has noted, make sure your user permissions are set. I usually tar my evolution components, and since I'm always the first (non-root) user on my Linux machines, when I un-tar and restore the files, the permissions are already set.

用批处理进行按星期的数据库备份

Posted on 八月 7th, 2006 in Computer | No Comments »

需要按星期进

@echo off
echo -----------
echo name: Oracle data export automata utility
echo author: WANG Liangxu
echo date: 2006-8-7
echo refined by NAN Zhuotong
echo documented by NAN Zhuotong
echo Any problem please contact us via wlx@mygis.org; nztong@lzb.ac.cn

REM This program is used to export data in Oracle to external files named with current date.
REM A simple export schema is employed. Monday the data will be completely exported.
REM Tuesday through Thursday data will be exported in an incremental manner.
REM Friday, data exported include all the incremental data since the last completed export.
REM Saturday and Sunday incremental export will be employed once more.

REM This program can be used together with Windows plan and task utility. In that way,
REM the program can be enhanced with running by schedule.

echo -----------
set w=%date:~13,1%
set d=%date:~0,4%%date:~5,2%%date:~8,2%
rem echo %d%
if %w%==一 goto 1
if %w%==二 goto 2
if %w%==三 goto 3
if %w%==四 goto 4
if %w%==五 goto 5
if %w%==六 goto 6
if %w%==日 goto 7

REM exp system/systemwestdc inctype=complete file=d:/ORADB-BACKUP/20060807.dmp (complete)
REM exp system/systemwestdc inctype=incremental file=d:/ORADB-BACKUP/2006xxxx.dmp
REM exp system/systemwestdc inctype=cumulative file=d:/ORADB-BACKUP/2006xxxx.dmp
REM Mon: 完全备份(A)
REM Tue: 增量导出(B)
REM Wed: 增量导出(C)
REM Thu: 增量导出(D)
REM Fri: 累计导出(E)
REM Sat: 增量导出(F)
REM Sun: 增量导出(G)

:1
echo Begin exporting data to file %d%-compl.dmp
exp system/systemwestdc inctype=complete file=d:/ORADB-BACKUP/%d%-compl.dmp
goto end
:2
echo Begin exporting data to file %d%-incre.dmp
exp system/systemwestdc inctype=incremental file=d:/ORADB-BACKUP/%d%-incre.dmp
goto end
:3
echo Begin exporting data to file %d%-incre.dmp
exp system/systemwestdc inctype=incremental file=d:/ORADB-BACKUP/%d%-incre.dmp
goto end
:4
echo Begin exporting data to file %d%-incre.dmp
exp system/systemwestdc inctype=incremental file=d:/ORADB-BACKUP/%d%-incre.dmp
goto end
:5
echo Begin exporting data to file %d%-cumul.dmp
exp system/systemwestdc inctype=cumulative file=d:/ORADB-BACKUP/%d%-cumul.dmp
goto end
:6
echo Begin exporting data to file %d%-incre.dmp
exp system/systemwestdc inctype=incremental file=d:/ORADB-BACKUP/%d%-incre.dmp
goto end
:7
echo Begin exporting data to file %d%-incre.dmp
exp system/systemwestdc inctype=incremental file=d:/ORADB-BACKUP/%d%-incre.dmp
goto end
:end

应该backup的几个目录

Posted on 三月 20th, 2006 in Linux | No Comments »

几次都只备份了/home目录,今天又看了一遍 Debian GNU/Linux Bible,摘录一下:
应该备份的目录:
/home:最重要的目录
/etc:软件的配置,LINUX下的配置基本都放在这个目录下
/var:软件的数据放置目录,若/var/www

笔记本与服务器的动态备份

Posted on 四月 19th, 2005 in Linux | 1 Comment »

需求:
笔记本上的home目录,需要动态备份到服务器,以保证数据的安全性。
在重新安装系统的时候,需要在从服务器备份回来。(重新安装系统也方便多了)
解决方案:
考虑到低带宽的应用,使用rsync来进行处理,每次只传输变化的部分。

rsync -a /home/wlx wlx@heihe.mygis.org:/home/wlx/backup_d410

删除多余部分(即本机上删除的,远程也删除)

rsync -avP --delete -t /home/wlx wlx@heihe.mygis.org:/home/wlx/backup_d410

数据库自动备份脚本

Posted on 十二月 16th, 2004 in Linux | No Comments »

在这儿有一个好的MYSQL自动备份脚本:http://bbs.chinaunix.net/forum/17/041004/418474.html

做了一些简单的修改,以支持同时备份多个数据库。
内容如下:

#!/bin/bash
#This is a ShellScript For Auto DB Backup
#Powered by aspbiz,2004-09
#Modifed by wlx,2004-12

#Setting
DBName=wordpress
DBUser=root
DBPasswd=
BackupPath=/www/backup/
LogFile=/www/backup/"$DBName".log
DBPath=/var/lib/mysql/
BackupMethod=mysqldump
#BackupMethod=mysqlhotcopy
#BackupMethod=tar
#Setting End

NewFile="$BackupPath""$DBName"$(date +%y%m%d).tgz
DumpFile="$BackupPath""$DBName"$(date +%y%m%d)
OldFile="$BackupPath""$DBName"$(date +%y%m%d --date='5 days ago').tgz

echo "-------------------------------------------" >> $LogFile
echo $(date +"%y-%m-%d %H:%M:%S") >> $LogFile
echo "--------------------------" >> $LogFile
#Delete Old File
if [ -f $OldFile ]
then
rm -f $OldFile >> $LogFile 2>&1
echo "[$OldFile]Delete Old File Success!" >> $LogFile
else
echo "[$OldFile]No Old Backup File!" >> $LogFile
fi

if [ -f $NewFile ]
then
echo "[$NewFile]The Backup File is exists,Can't Backup!" >> $LogFile
else
case $BackupMethod in
mysqldump)
if [ -z $DBPasswd ]
then
mysqldump -u $DBUser --opt $DBName > $DumpFile
else
mysqldump -u $DBUser -p$DBPasswd --opt $DBName > $DumpFile
fi
tar czvf $NewFile $DumpFile >> $LogFile 2>&1
echo "[$NewFile]Backup Success!" >> $LogFile
rm -rf $DumpFile
;;
mysqlhotcopy)
rm -rf $DumpFile
mkdir $DumpFile
if [ -z $DBPasswd ]
then
mysqlhotcopy -u $DBUser $DBName $DumpFile >> $LogFile 2>&1
else
mysqlhotcopy -u $DBUser -p $DBPasswd $DBName $DumpFile >>$LogFile 2>&1
fi
tar czvf $NewFile $DumpFile >> $LogFile 2>&1
echo "[$NewFile]Backup Success!" >> $LogFile
rm -rf $DumpFile
;;
*)
/etc/init.d/mysqld stop >/dev/null 2>&1
tar czvf $NewFile $DBPath$DBName >> $LogFile 2>&1
/etc/init.d/mysqld start >/dev/null 2>&1
echo "[$NewFile]Backup Success!" >> $LogFile
;;
esac
fi

echo "-------------------------------------------" >> $LogFile