whitespaces and comments

This commit is contained in:
Jérémy Lecour 2023-12-29 14:05:01 +01:00 committed by Jérémy Lecour
parent b7ce6e1cff
commit a0f5c31175
Signed by: jlecour
SSH key fingerprint: SHA256:h+5LgHRKwN9lS0SsdVR5yZPeFlJE4Mt+8UtL4CcP8dY
3 changed files with 41 additions and 28 deletions

View file

@ -129,24 +129,15 @@ dump_redis() {
# Arguments: # Arguments:
# --user=[String] (default: <blank>) # --user=[String] (default: <blank>)
# --password=[String] (default: <blank>) # --password=[String] (default: <blank>)
#
# don't forget to create use with read-only access
# > use admin
# > db.createUser( { user: "mongobackup", pwd: "PASS", roles: [ "backup", ] } )
####################################################################### #######################################################################
dump_mongodb() { dump_mongodb() {
## don't forget to create use with read-only access
## > use admin
## > db.createUser( { user: "mongobackup", pwd: "PASS", roles: [ "backup", ] } )
local dump_dir="${LOCAL_BACKUP_DIR}/mongodump"
local errors_dir=$(errors_dir_from_dump_dir "${dump_dir}")
rm -rf "${dump_dir}" "${errors_dir}"
mkdir -p "${dump_dir}" "${errors_dir}"
# No need to change recursively, the top directory is enough
chmod 700 "${dump_dir}" "${errors_dir}"
local error_file="${errors_dir}.err"
log "LOCAL_TASKS - ${FUNCNAME[0]}: start ${dump_dir}"
local option_user="" local option_user=""
local option_password="" local option_password=""
# Parse options, based on https://gist.github.com/deshion/10d3cb5f88a21671e17a # Parse options, based on https://gist.github.com/deshion/10d3cb5f88a21671e17a
while :; do while :; do
case ${1:-''} in case ${1:-''} in
@ -206,6 +197,16 @@ dump_mongodb() {
shift shift
done done
local dump_dir="${LOCAL_BACKUP_DIR}/mongodump"
local errors_dir=$(errors_dir_from_dump_dir "${dump_dir}")
rm -rf "${dump_dir}" "${errors_dir}"
mkdir -p "${dump_dir}" "${errors_dir}"
# No need to change recursively, the top directory is enough
chmod 700 "${dump_dir}" "${errors_dir}"
local error_file="${errors_dir}.err"
log "LOCAL_TASKS - ${FUNCNAME[0]}: start ${dump_dir}"
declare -a options declare -a options
options=() options=()
options+=(--username="${option_user}") options+=(--username="${option_user}")
@ -270,14 +271,8 @@ dump_megacli_config() {
# --targets=[IP,HOST] (default: <none>) # --targets=[IP,HOST] (default: <none>)
####################################################################### #######################################################################
dump_traceroute() { dump_traceroute() {
local dump_dir="${LOCAL_BACKUP_DIR}/traceroute"
local errors_dir=$(errors_dir_from_dump_dir "${dump_dir}")
rm -rf "${dump_dir}" "${errors_dir}"
mkdir -p "${dump_dir}" "${errors_dir}"
# No need to change recursively, the top directory is enough
chmod 700 "${dump_dir}" "${errors_dir}"
local option_targets="" local option_targets=""
# Parse options, based on https://gist.github.com/deshion/10d3cb5f88a21671e17a # Parse options, based on https://gist.github.com/deshion/10d3cb5f88a21671e17a
while :; do while :; do
case ${1:-''} in case ${1:-''} in
@ -318,6 +313,14 @@ dump_traceroute() {
shift shift
done done
local dump_dir="${LOCAL_BACKUP_DIR}/traceroute"
local errors_dir=$(errors_dir_from_dump_dir "${dump_dir}")
rm -rf "${dump_dir}" "${errors_dir}"
mkdir -p "${dump_dir}" "${errors_dir}"
# No need to change recursively, the top directory is enough
chmod 700 "${dump_dir}" "${errors_dir}"
mtr_bin=$(command -v mtr) mtr_bin=$(command -v mtr)
if [ -n "${mtr_bin}" ]; then if [ -n "${mtr_bin}" ]; then
for target in "${option_targets[@]}"; do for target in "${option_targets[@]}"; do
@ -400,6 +403,7 @@ dump_rabbitmq() {
local error_file="${errors_dir}.err" local error_file="${errors_dir}.err"
local dump_file="${dump_dir}/config" local dump_file="${dump_dir}/config"
log "LOCAL_TASKS - ${FUNCNAME[0]}: start ${dump_file}" log "LOCAL_TASKS - ${FUNCNAME[0]}: start ${dump_file}"
rabbitmqadmin export "${dump_file}" 2> "${error_file}" >> "${LOGFILE}" rabbitmqadmin export "${dump_file}" 2> "${error_file}" >> "${LOGFILE}"
@ -451,8 +455,6 @@ dump_facl() {
# --snapshot=[String] (default: snapshot.daily) # --snapshot=[String] (default: snapshot.daily)
####################################################################### #######################################################################
dump_elasticsearch_snapshot_singlenode() { dump_elasticsearch_snapshot_singlenode() {
log "LOCAL_TASKS - ${FUNCNAME[0]}: start dump_elasticsearch_snapshot_singlenode"
local option_protocol="http" local option_protocol="http"
local option_host="localhost" local option_host="localhost"
local option_port="9200" local option_port="9200"
@ -460,6 +462,7 @@ dump_elasticsearch_snapshot_singlenode() {
local option_password="" local option_password=""
local option_repository="snaprepo" local option_repository="snaprepo"
local option_snapshot="snapshot.daily" local option_snapshot="snapshot.daily"
# Parse options, based on https://gist.github.com/deshion/10d3cb5f88a21671e17a # Parse options, based on https://gist.github.com/deshion/10d3cb5f88a21671e17a
while :; do while :; do
case ${1:-''} in case ${1:-''} in
@ -614,6 +617,8 @@ dump_elasticsearch_snapshot_singlenode() {
shift shift
done done
log "LOCAL_TASKS - ${FUNCNAME[0]}: start ${option_snapshot}"
## Take a snapshot as a backup. ## Take a snapshot as a backup.
## Warning: You need to have a path.repo configured. ## Warning: You need to have a path.repo configured.
## See: https://wiki.evolix.org/HowtoElasticsearch#snapshots-et-sauvegardes ## See: https://wiki.evolix.org/HowtoElasticsearch#snapshots-et-sauvegardes
@ -640,7 +645,7 @@ dump_elasticsearch_snapshot_singlenode() {
# echo 'Cannot make a snapshot of elasticsearch, at least one node is not mounting the repository.' # echo 'Cannot make a snapshot of elasticsearch, at least one node is not mounting the repository.'
# fi # fi
log "LOCAL_TASKS - ${FUNCNAME[0]}: stop dump_elasticsearch_snapshot_singlenode" log "LOCAL_TASKS - ${FUNCNAME[0]}: stop ${option_snapshot}"
} }
####################################################################### #######################################################################
@ -657,8 +662,6 @@ dump_elasticsearch_snapshot_singlenode() {
# --nfs-server=[IP|HOST] (default: <none>) # --nfs-server=[IP|HOST] (default: <none>)
####################################################################### #######################################################################
dump_elasticsearch_snapshot_multinode() { dump_elasticsearch_snapshot_multinode() {
log "LOCAL_TASKS - ${FUNCNAME[0]}: start dump_elasticsearch_snapshot_multinode"
local option_protocol="http" local option_protocol="http"
local option_host="localhost" local option_host="localhost"
local option_port="9200" local option_port="9200"
@ -667,6 +670,7 @@ dump_elasticsearch_snapshot_multinode() {
local option_repository="snaprepo" local option_repository="snaprepo"
local option_snapshot="snapshot.daily" local option_snapshot="snapshot.daily"
local option_nfs_server="" local option_nfs_server=""
# Parse options, based on https://gist.github.com/deshion/10d3cb5f88a21671e17a # Parse options, based on https://gist.github.com/deshion/10d3cb5f88a21671e17a
while :; do while :; do
case ${1:-''} in case ${1:-''} in
@ -840,6 +844,8 @@ dump_elasticsearch_snapshot_multinode() {
shift shift
done done
log "LOCAL_TASKS - ${FUNCNAME[0]}: start ${option_snapshot}"
## Take a snapshot as a backup. ## Take a snapshot as a backup.
## Warning: You need to have a path.repo configured. ## Warning: You need to have a path.repo configured.
## See: https://wiki.evolix.org/HowtoElasticsearch#snapshots-et-sauvegardes ## See: https://wiki.evolix.org/HowtoElasticsearch#snapshots-et-sauvegardes
@ -862,5 +868,5 @@ dump_elasticsearch_snapshot_multinode() {
echo 'Cannot make a snapshot of elasticsearch, at least one node is not mounting the repository.' echo 'Cannot make a snapshot of elasticsearch, at least one node is not mounting the repository.'
fi fi
log "LOCAL_TASKS - ${FUNCNAME[0]}: stop dump_elasticsearch_snapshot_multinode" log "LOCAL_TASKS - ${FUNCNAME[0]}: stop ${option_snapshot}"
} }

View file

@ -31,6 +31,7 @@ dump_mysql_summary() {
local option_user="" local option_user=""
local option_password="" local option_password=""
local option_dump_label="" local option_dump_label=""
# Parse options, based on https://gist.github.com/deshion/10d3cb5f88a21671e17a # Parse options, based on https://gist.github.com/deshion/10d3cb5f88a21671e17a
while :; do while :; do
case ${1:-''} in case ${1:-''} in
@ -294,6 +295,7 @@ dump_mysql_grants() {
local option_user="" local option_user=""
local option_password="" local option_password=""
local option_dump_label="" local option_dump_label=""
# Parse options, based on https://gist.github.com/deshion/10d3cb5f88a21671e17a # Parse options, based on https://gist.github.com/deshion/10d3cb5f88a21671e17a
while :; do while :; do
case ${1:-''} in case ${1:-''} in
@ -512,6 +514,7 @@ dump_mysql_global() {
local option_user="" local option_user=""
local option_password="" local option_password=""
local option_dump_label="" local option_dump_label=""
# Parse options, based on https://gist.github.com/deshion/10d3cb5f88a21671e17a # Parse options, based on https://gist.github.com/deshion/10d3cb5f88a21671e17a
while :; do while :; do
case ${1:-''} in case ${1:-''} in
@ -802,6 +805,7 @@ dump_mysql_per_base() {
local option_port="" local option_port=""
local option_socket="" local option_socket=""
local option_dump_label="" local option_dump_label=""
# Parse options, based on https://gist.github.com/deshion/10d3cb5f88a21671e17a # Parse options, based on https://gist.github.com/deshion/10d3cb5f88a21671e17a
while :; do while :; do
case ${1:-''} in case ${1:-''} in
@ -965,6 +969,7 @@ dump_mysql_tabs() {
local option_port="" local option_port=""
local option_socket="" local option_socket=""
local option_dump_label="" local option_dump_label=""
# Parse options, based on https://gist.github.com/deshion/10d3cb5f88a21671e17a # Parse options, based on https://gist.github.com/deshion/10d3cb5f88a21671e17a
while :; do while :; do
case ${1:-''} in case ${1:-''} in

View file

@ -138,7 +138,9 @@ local_tasks() {
# Run dump-server-state to extract system information # Run dump-server-state to extract system information
# #
# Options : any dump-server-state option (see 'dump-server-state -h') # Options : any dump-server-state supported option
# (except --dump-dir that will be overwritten)
# See 'dump-server-state -h' for details.
# #
dump_server_state dump_server_state