Skip to content

Commit 1d9cf67

Browse files
committed
v2.5
1 parent ea637a0 commit 1d9cf67

File tree

3 files changed

+41
-3
lines changed

3 files changed

+41
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Change Log
22

3+
## 2.5 - (2006-01-15)
4+
- Added support for setting MAXIMUM_PACKET_SIZE and SOCKET parameters. (suggested by Yvo van Doorn)
5+
36
## 2.4 - (2006-01-23)
47
- Fixed bug where weekly backups were not being rotated. (fix by wolf02)
58
- Added hour an min to backup filename for the case where backups are taken multiple times in a day.

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,16 @@ To set the day of the week that you would like the weekly backup to happen set t
9393

9494
`LATEST` is to store an additional copy of the latest backup to a standard location so it can be downloaded by thrid party scripts.
9595

96+
### Blob
97+
98+
If the DB's being backed up make use of large `BLOB` fields then you may need to increase the `MAX_ALLOWED_PACKET` setting, for example 16MB.
99+
100+
### Socket
101+
102+
When connecting to localhost as the DB server (`DBHOST=localhost`) sometimes the system can have issues locating the socket file. This can now be set using the `SOCKET` parameter. An example may be
103+
104+
SOCKET=/private/tmp/mysql.sock
105+
96106
### Pre-Backup and Post-Backup Scripts
97107

98108
Use `PREBACKUP` and `POSTBACKUP` to specify Per and Post backup commands or scripts to perform tasks either before or after the backup process.

automysqlbackup.sh

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
#
33
# MySQL Backup Script
4-
# VER. 2.4 - http://sourceforge.net/projects/automysqlbackup/
4+
# VER. 2.5 - http://sourceforge.net/projects/automysqlbackup/
55
# Copyright (c) 2002-2003 [email protected]
66
#
77
# This program is free software; you can redistribute it and/or modify
@@ -82,6 +82,12 @@ COMMCOMP=no
8282
# Additionally keep a copy of the most recent backup in a seperate directory.
8383
LATEST=no
8484

85+
# The maximum size of the buffer for client/server communication. e.g. 16MB (maximum is 1GB)
86+
MAX_ALLOWED_PACKET=
87+
88+
# For connections to localhost. Sometimes the Unix socket file must be specified.
89+
SOCKET=
90+
8591
# Command to run before backups (uncomment to use)
8692
#PREBACKUP="/etc/mysql-backup-pre"
8793

@@ -177,6 +183,13 @@ LATEST=no
177183
# LATEST is to store an additional copy of the latest backup to a standard
178184
# location so it can be downloaded bt thrid party scripts.
179185
#
186+
# If the DB's being backed up make use of large BLOB fields then you may need
187+
# to increase the MAX_ALLOWED_PACKET setting, for example 16MB..
188+
#
189+
# When connecting to localhost as the DB server (DBHOST=localhost) sometimes
190+
# the system can have issues locating the socket file.. This can now be set
191+
# using the SOCKET parameter.. An example may be SOCKET=/private/tmp/mysql.sock
192+
#
180193
# Use PREBACKUP and POSTBACKUP to specify Per and Post backup commands
181194
# or scripts to perform tasks either before or after the backup process.
182195
#
@@ -229,6 +242,8 @@ LATEST=no
229242
# Change Log
230243
#=====================================================================
231244
#
245+
# VER 2.5 - (2006-01-15)
246+
# Added support for setting MAXIMUM_PACKET_SIZE and SOCKET parameters (suggested by Yvo van Doorn)
232247
# VER 2.4 - (2006-01-23)
233248
# Fixed bug where weekly backups were not being rotated. (Fix by wolf02)
234249
# Added hour an min to backup filename for the case where backups are taken multiple
@@ -327,7 +342,7 @@ DNOW=`date +%u` # Day number of the week 1 to 7 where 1 represents Monday
327342
DOM=`date +%d` # Date of the Month e.g. 27
328343
M=`date +%B` # Month e.g January
329344
W=`date +%V` # Week Number e.g 37
330-
VER=2.4 # Version Number
345+
VER=2.5 # Version Number
331346
LOGFILE=$BACKUPDIR/$DBHOST-`date +%N`.log # Logfile Name
332347
LOGERR=$BACKUPDIR/ERRORS_$DBHOST-`date +%N`.log # Logfile Name
333348
BACKUPFILES=""
@@ -339,6 +354,12 @@ if [ "$COMMCOMP" = "yes" ];
339354
OPT="$OPT --compress"
340355
fi
341356

357+
# Add --compress mysqldump option to $OPT
358+
if [ "$MAX_ALLOWED_PACKET" ];
359+
then
360+
OPT="$OPT --max_allowed_packet=$MAX_ALLOWED_PACKET"
361+
fi
362+
342363
# Create required directories
343364
if [ ! -e "$BACKUPDIR" ] # Check Backup Directory exists.
344365
then
@@ -388,7 +409,7 @@ mysqldump --user=$USERNAME --password=$PASSWORD --host=$DBHOST $OPT $1 > $2
388409
return 0
389410
}
390411

391-
# Compression function
412+
# Compression function plus latest copy
392413
SUFFIX=""
393414
compression () {
394415
if [ "$COMP" = "gzip" ]; then
@@ -437,6 +458,9 @@ fi
437458
# Hostname for LOG information
438459
if [ "$DBHOST" = "localhost" ]; then
439460
HOST=`hostname`
461+
if [ "$SOCKET" ]; then
462+
OPT="$OPT --socket=$SOCKET"
463+
fi
440464
else
441465
HOST=$DBHOST
442466
fi
@@ -639,6 +663,7 @@ then
639663
else
640664
if [ -s "$LOGERR" ]
641665
then
666+
cat "$LOGFILE"
642667
echo
643668
echo "###### WARNING ######"
644669
echo "Errors reported during AutoMySQLBackup execution.. Backup failed"

0 commit comments

Comments
 (0)