As stated by the title, this post presents a way to:
This method makes use of the Linux cron jobs and therefore is useful for those whose websites are hosted on the Linux server with C-Panel (as C-Panel supplies cron jobs).
Two scripts realize the desired function: backup.sh and sendmail.py. The former is the bash shell script which backs up the database (files), while the latter is the python script which emails the backup to you. Theses scripts, though very rough, were first published in the older post. Now, they have been improved and a new version comes out. This work is inspirited by Liunian.
Features of this method:
- Automatically
- Not only back up database, but also back up anything as you want
- Supply a clear list of the backup in the email
- Let the fool plugin go away
Screenshot:

Installation:
- Download the scripts (including backup.sh and sendmail.py)
- Create a new directory anywhere (e.g., /home/username/backup)
- Finish the configuration in the beginning of the file backup.sh FOLLOWING THE DIRECTIONS GIVEN THERE
- Upload the two files backup.sh and sendmail.py to the directory created previously, and change their permissions to be 700
- Submit the cron job in C-panel. The command usually has the form as (Here SCRIPT_DIR is the directory created previously)
SCRIPT_DIR/backup.sh
Other notes:
- Directions about the configuration are given below in Chinese. Only 9 lines are needed to be configured.
############## Configuraion Begins ################ ##--------Configuration I: Database & WP Directories------------- ## wp-config.php所在目录 WP_CONFIG=/home/username/public_html/wp-config.php ## 如果想明确给出数据库参数,将下面三行去掉屏蔽并参考wp-config.php填写。 ## 但是,当前面的WP_CONFIG给出了正确的位置,这里的参数将不起作用。 # S_DB_USER=db_user # S_DB_PASSWORD=db_password # S_DB_NAME=db_name ## 将要存放脚本 "backup.sh" 和 "sendmail.py"的目录。可自创建。 SCRIPT_DIR=/home/username/backup_script ## 将要生成数据库备份的目录。 DB_BACKUP_DIR=/home/username/public_html ## 其它需要备份的目录或者文件。 ## 格式: WP_BACKUP_DIRS=(directory1 directory2 directory3). ## 如果不需要,直接留个空的括号。 WP_BACKUP_DIRS=(/home/username/public_html/wp-content/themes) ##--------Configuration II: Mail Account-------------- ## 利用站点空间提供的邮箱服务。 ## 可以在C-panel自己创建一个邮箱帐户。 ## 关于邮箱的相关信息可以在C-panle的 "webmail->goto webmail login->configure mail account" 中查找。 ## 下面以ATBHOST的邮箱服务为例说明配置. ## 自定义发送者,随意。 From=Backup@vastars.info ## 邮件接受者。 To=receiver@gmail.com ## 站点空间的邮箱服务器。 mail_host=server01.atbhost.net ## 邮箱帐户 mail_user=mailuser ## 邮箱密码 mail_pass=*** ############## Configuraion Ends ################
- For more information, one can refer to this older post in 中文 and this latest post in 中文
呵呵,佩服
还是手动备份呢,没用工具~~~
手真勤劳~
备份是每天都要做的
呵呵。所以能交给机器做的就交给机器做吧。
哈哈,来了几次三番了,还是E文没更新呢
真够费劲的说一声
呵呵。你重出江湖了?!
还是看不懂啊
为啥要用英文写呢,对我有打击的
怎么会呢?!
我现在都手动备份
有耐性呐!
郁闷啊!我看你排版严重错位啊!
你是IE6.
IE6是死敌。
这句经典!哈哈
成功了,不过全是英文看得我脑痛,不过还是谢谢博主了.
Congratulations
wow..这么长一个单词都记得。。厉害~~
都英文,我在做梦?
晕。。你什么时候做这个产品了。。
呵呵,英文的哦,星尘真厉害
呵呵 还以为救我一个人看花了啊
呃。。
这个头像不错~
我眼花了吗 怎么都是英文啊??
榴莲呀。。
呵呵。还真是
飞猪怎么一直没有国籍?
难道我这么快就被驱逐了?
米国啊得国啊你们就收了我罢。。
这个我觉得。。我ms看得懂。。。
我把牛津高阶找来放到电脑旁再来慢慢看
Vastar,我的小站换了新域名http://www.iharo.com,烦请您修改一下,希望继续友情。
都翻译了那么长文章的人。如果看不清楚只可能是没写清楚啊。。。
已经更新
呵呵,居然写英文的教程呢。。。牛……
自动备份数据库和文件并发送到你的邮箱,这个功能确实不错。不过不用插件实现就有点新鲜了,找个时间我也这样试试看。
居然是英文,不错不错