Skip to content

Commit 59ad26f

Browse files
authored
Merge pull request #920 from pixelpark/master
Use gfind instead of find and gxargs instead of xargs on solaris
2 parents a32697f + fdea88b commit 59ad26f

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

templates/mysqlbackup.sh.erb

+10-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ ROTATE=<%= [ Integer(@backuprotate) - 1, 0 ].max %>
2222

2323
# Create temporary mysql cnf file.
2424
TMPFILE=`mktemp /tmp/backup.XXXXXX` || exit 1
25+
<%- if @kernel == 'SunOS' -%>
26+
echo "[client]\npassword=$PASS\nuser=$USER\nmax_allowed_packet=$MAX_ALLOWED_PACKET" > $TMPFILE
27+
<%- else -%>
2528
echo -e "[client]\npassword=$PASS\nuser=$USER\nmax_allowed_packet=$MAX_ALLOWED_PACKET" > $TMPFILE
29+
<%- end -%>
30+
2631

2732
# Ensure backup directory exist.
2833
mkdir -p $DIR
@@ -60,7 +65,11 @@ set -o pipefail
6065

6166
cleanup()
6267
{
63-
find "${DIR}/" -maxdepth 1 -type f -name "${PREFIX}*.sql*" -mtime +${ROTATE} -print0 | xargs -0 -r rm -f
68+
<%- if @kernel == 'SunOS' -%>
69+
gfind "${DIR}/" -maxdepth 1 -type f -name "${PREFIX}*.sql*" -mtime +${ROTATE} -print0 | gxargs -0 -r rm -f
70+
<%- else -%>
71+
find "${DIR}/" -maxdepth 1 -type f -name "${PREFIX}*.sql*" -mtime +${ROTATE} -print0 | xargs -0 -r rm -f
72+
<%- end -%>
6473
}
6574

6675
<% if @delete_before_dump -%>

0 commit comments

Comments
 (0)