Mercurial > repos > other > Puppet
view modules/mysql/templates/xtrabackup.sh.erb @ 426:1d6cf5d981be
Try to resolve more CSP errors
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Fri, 14 Oct 2022 19:18:57 +0100 |
parents | 668df4711671 |
children | c6c9a2cfcfbd |
line wrap: on
line source
<%- if @kernel == 'Linux' -%> #!/bin/bash <%- else -%> #!/bin/sh <%- end -%> # # A wrapper for Xtrabackup ROTATE=<%= [ Integer(@backuprotate) - 1, 0 ].max %> DIR=<%= @backupdir %> # Ensure backup directory exist. mkdir -p $DIR <%- if @kernel == 'Linux' -%> set -o pipefail <%- end -%> <% if @prescript -%> <%- [@prescript].flatten.compact.each do |script| %> <%= script %> <%- end -%> <% end -%> cleanup() { <%- if @kernel == 'SunOS' -%> gfind "${DIR}/" -mindepth 1 -maxdepth 1 -mtime +${ROTATE} -print0 | gxargs -0 -r rm -rf <%- else -%> find "${DIR}/" -mindepth 1 -maxdepth 1 -mtime +${ROTATE} -print0 | xargs -0 -r rm -rf <%- end -%> } <% if @delete_before_dump -%> cleanup <% end -%> <%- _innobackupex_args = '' -%> <%- if @backupuser and @backuppassword_unsensitive -%> <%- _innobackupex_args = '--user="' + @backupuser + '" --password="' + @backuppassword_unsensitive + '"' -%> <%- end -%> <%- if @backupcompress -%> <%- _innobackupex_args = _innobackupex_args + ' --compress' -%> <%- end -%> <%- if @backupdatabases and @backupdatabases.is_a?(Array) and !@backupdatabases.empty? -%> <%- _innobackupex_args = _innobackupex_args + ' --databases="' + @backupdatabases.join(' ') + '"' -%> <%- end -%> <%- if @optional_args and @optional_args.is_a?(Array) -%> <%- @optional_args.each do |arg| -%> <%- _innobackupex_args = _innobackupex_args + ' ' + arg -%> <%- end -%> <%- end -%> <%= @backupmethod -%> <%= _innobackupex_args %> $@ <% unless @delete_before_dump -%> if [ $? -eq 0 ] ; then cleanup touch <%= @backup_success_file_path %> fi <% end -%> <% if @postscript -%> <%- [@postscript].flatten.compact.each do |script| %> <%= script %> <%- end -%> <% end -%>