mysql 自动备份 脚本

automysqlbackup-2.5.1-01.sh  最新版 点这里下载

使用说明:

1. 修改文件里的配置部分包括访问mysql的用户名密码,要备份的数据库,备份地址,发送邮件的地址(默认使用postfix):

[cce]
    # Username to access the MySQL server e.g. dbuser
	USERNAME=debian

	# Password to access the MySQL server e.g. password
	PASSWORD=

	# Host name (or IP address) of MySQL server e.g localhost
	DBHOST=localhost

	# List of DBNAMES for Daily/Weekly Backup e.g. "DB1 DB2 DB3"
	DBNAMES="all"

	# Backup directory location e.g /backups
	BACKUPDIR="/srv/backup/db"

	# Mail setup
	# What would you like to be mailed to you?
	# - log   : send only log file
	# - files : send log file and sql files as attachments (see docs)
	# - stdout : will simply output the log to the screen if run manually.
	# - quiet : Only send logs if an error occurs to the MAILADDR.
	MAILCONTENT="log"

	# Set the maximum allowed email size in k. (4000 = approx 5MB email [see docs])
	MAXATTSIZE="4000"

	# Email Address to send mail to? (user@domain.com)
	MAILADDR="maintenance@example.com"
[/cce]

也可以把上面的东西写到一个配置文件里:

[cce]CONFIGFILE="/etc/automysqlbackup/automysqlbackup.conf"[/cce]

2. 给脚本增加可执行权限

[cce]chmod +x /root/automysqlbackup-2.5.1-01.sh[/cce]
3.用crontab定一个任务:比如每周一的零点备份
[cce]
crontab e

#输入下面的任务:
#格式为dom=day of month
#m h  dom mon dow   command

0 0 * * 1 /var/www/sqlback/automysqlbackup.sh
[/cce]

4.安装postfix,备份日志会自动发送到上面指定的邮箱
[cce]
# for redhat
yum install postfix

# for ubuntu
apt-get install postfix
[/cce]
大功告成,该脚本会在备份文件夹里自动建立monthly,weekly,daily的文件夹

	

Deploy WP site

Add DNS in cndns.com #like pmcb.zjueke.com  A record  60.12.107.213

ssh dabaobao@60.12.107.213

mkdir /var/www/html/pmcb

chmod -R 777 /var/www/html/pmcb/

 

# configure apache for pmcb.zjueke.com

cd /etc/apache2/

cd sites-available/

cp www.zjueke.com pmcb.zjueke.com

vim pmcb.zjueke.com (edit its document root and DNS)

a2ensite pmcb.zjueke.com  (apache 2 enable site…)

/etc/init.d/apache2 reload

 

install wordpress and theme:

cd /var/www/html/pmcb/

wget http://cn.wordpress.org/wordpress-3.4.2-zh_CN.tar.gz

tar -zxvf wordpress-3.4.2-zh_CN.tar.gz

cp -r ./wordpress/* ./   (copy all wordpress files to current directory)

 

 

visit pmcb.zjueke.com to install it.

you can visit it now.

 

after installation, delete all the default database, and import your pbcm.sql with “127.0.0.1/pmcb” replaced by “pmcb.zjueke.com”

 

that’s all!

redhat终于爽了

用惯了ubuntu的apt-get,看redhat里的yum是要多不顺眼就有多不顺眼,从yum不能用,到源不能用,从源里少软件包,到软件包安装的依赖关系,简直让人在redhat上举步维艰,而你想爽一点,redhat还要问你收费,给你企业级的源支持。

 

但终于,我把redhat的安装iso光盘mount到本地,里面的Packages(RHEL6)或者Servers(RHEL5)有着几乎你需要用到的一切rpm,再说少什么,你准能找到。

不过依赖关系还是存在,没关系,就像1需要2,2需要3和4,3有需要567,4需要8你就84765321的装回去。

看着它不报错,默默的辛苦安装,终于爽了!!!心里还要配上画外音:让你丫的墨迹,这下老实了吧。