Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
tingweiwang
/
mysql-backup
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit e03e6c43
authored
Nov 08, 2019
by
tingweiwang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改全备的删除时间为1天
1 parent
8567a2c0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 additions
and
1 deletions
mysql_backup.sh
mysql_backup.sh
View file @
e03e6c4
...
@@ -31,7 +31,7 @@ echo "创建mysql全库备份所需目录"
...
@@ -31,7 +31,7 @@ echo "创建mysql全库备份所需目录"
test
-d
$BACK_PATH
/
$DATE
-all
||
mkdir
$BACK_PATH
/
$DATE
-all -pv
test
-d
$BACK_PATH
/
$DATE
-all
||
mkdir
$BACK_PATH
/
$DATE
-all -pv
mysqldump -u
${
USER
}
-p
${
PASSWD
}
-h
$HOST
--routines --single-transaction --master-data
=
2 -A -B -F |gzip >
$BACK_PATH
/
$DATE
-all/all.sql.gz
mysqldump -u
${
USER
}
-p
${
PASSWD
}
-h
$HOST
--routines --single-transaction --master-data
=
2 -A -B -F |gzip >
$BACK_PATH
/
$DATE
-all/all.sql.gz
find
$BACK_PATH
/ -m
min
+1 -type d |xargs rm -rf
find
$BACK_PATH
/ -m
time
+1 -type d |xargs rm -rf
}
}
#搭配计划任务,执行频率为1天1次,只保留一天的备份。
#搭配计划任务,执行频率为1天1次,只保留一天的备份。
###################################################################################################
###################################################################################################
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment