-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathclean-up-backups.sh
executable file
·88 lines (59 loc) · 1.6 KB
/
clean-up-backups.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/bash
#
# The goal is to only delete old backups if necessary
#
UTILDIR=/home/mysql/util
# Source common options
. $UTILDIR/bk-common.sh
# BACKUPDIRBASE=/data/backup
#
# # TODO: test if it exists
#
#
# # normal backups are marked with "crondaily" in the backup filename
#
# # TODO: establish crondaily, cronweekly, & cronmonthly backups
#
echo "----------------------------------------"
echo ""
echo " MySQL backups cleanup report "
echo ""
echo "----------------------------------------"
display_header
display_disk_usage
display_age_settings
display_counts
delete_old_backups
# not sure if this is working right
delete_empty_dirs
display_disk_usage
echo ""
echo ""
#echo "----------------------------------------"
#delete_old_backups() {
#
# #
# # delete the old ones
# #
#
# echo "Deleting $SINGLESOLD Single backups more than $SINGLESMAXAGE days old ... "
# sleep 2
# find ${BACKUPDIRBASE}/ -regex '.*single.*' -mtime +${SINGLESMAXAGE} -exec rm {} \;
#
# echo "Deleting $MONTHLYSOLD Monthly backups more than $MONTHLYMAXAGE days old ... "
# sleep 2
# find ${BACKUPDIRBASE}/ -regex '.*cronmonthly.*' -mtime +${MONTHLYMAXAGE} -exec rm {} \;
#
# echo "Deleting $WEEKLYSOLD Weekly backups more than $WEEKLYMAXAGE days old ... "
# sleep 2
# find ${BACKUPDIRBASE}/ -regex '.*cronweekly.*' -mtime +${WEEKLYMAXAGE} -exec rm {} \;
#
# echo "Deleting $DAILYSOLD Daily backups more than $DAILYMAXAGE days old ... "
# sleep 2
# find ${BACKUPDIRBASE}/ -regex '.*crondaily.*' -mtime +${DAILYMAXAGE} -exec rm {} \;
#
#}
#
#
# END
#