Home > Database > Mysql Tutorial > linux下定时以时间命名备份数据库

linux下定时以时间命名备份数据库

WBOY
Release: 2016-06-07 16:01:35
Original
975 people have browsed it

bakfordatabase.sh mysqldump -uuser -ppassword databasefolder/`date +%Y-%m-%d~%H-%M-%S`.sql 以时间命名备份mysql数据库 mongodump -d database -o folder 备份mongodb数据库 cd folder tar -cf database- +%Y-%m-%d.tar database 打包备份后到文件 rm -

bakfordatabase.sh
mysqldump -uuser -ppassword database>folder/`date  "+%Y-%m-%d~%H-%M-%S"`.sql

以时间命名备份mysql数据库

mongodump -d database -o folder ‘备份mongodb数据库

cd folder

tar -cf database-'' +%Y-%m-%d''.tar database ‘打包备份后到文件

rm -r database ’删除原文件

以时间命名备份mangodb数据库

00 07 * * * sh folder/bakfordatabase.sh
<pre name="code" class="plain">00 */8 * * * sh folder/bakfordatabase.sh 
Copy after login

crontab 里面定时备份
 

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template