forked from evolix/evobackup
client: tolerate absence of mtr or traceroute
This commit is contained in:
parent
c769a6e823
commit
f683691853
|
@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
* update-evobackup-canary: do not use GNU date, for it to be compatible with OpenBSD
|
* update-evobackup-canary: do not use GNU date, for it to be compatible with OpenBSD
|
||||||
* Add AGPL License and README
|
* Add AGPL License and README
|
||||||
* Script now depends on Bash
|
* Script now depends on Bash
|
||||||
|
* tolerate absence of mtr or traceroute
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
|
|
||||||
|
|
|
@ -182,9 +182,11 @@ local_tasks() {
|
||||||
# rm -rf ${LOCAL_BACKUP_DIR}/pg.*.gz
|
# rm -rf ${LOCAL_BACKUP_DIR}/pg.*.gz
|
||||||
# rm -rf ${LOCAL_BACKUP_DIR}/pg-backup.tar
|
# rm -rf ${LOCAL_BACKUP_DIR}/pg-backup.tar
|
||||||
# rm -rf ${LOCAL_BACKUP_DIR}/postgresql/*
|
# rm -rf ${LOCAL_BACKUP_DIR}/postgresql/*
|
||||||
|
|
||||||
## example with pg_dumpall (warning: you need space in ~postgres)
|
## example with pg_dumpall (warning: you need space in ~postgres)
|
||||||
# su - postgres -c "pg_dumpall > ~/pg.dump.bak"
|
# su - postgres -c "pg_dumpall > ~/pg.dump.bak"
|
||||||
# mv ~postgres/pg.dump.bak ${LOCAL_BACKUP_DIR}/
|
# mv ~postgres/pg.dump.bak ${LOCAL_BACKUP_DIR}/
|
||||||
|
|
||||||
## another method with gzip directly piped
|
## another method with gzip directly piped
|
||||||
# cd /var/lib/postgresql
|
# cd /var/lib/postgresql
|
||||||
# sudo -u postgres pg_dumpall | gzip > ${LOCAL_BACKUP_DIR}/pg.dump.bak.gz
|
# sudo -u postgres pg_dumpall | gzip > ${LOCAL_BACKUP_DIR}/pg.dump.bak.gz
|
||||||
|
@ -265,10 +267,19 @@ local_tasks() {
|
||||||
#megacli -CfgSave -f ${LOCAL_BACKUP_DIR}/megacli_conf.dump -a0 >/dev/null
|
#megacli -CfgSave -f ${LOCAL_BACKUP_DIR}/megacli_conf.dump -a0 >/dev/null
|
||||||
|
|
||||||
## Dump network routes with mtr and traceroute (warning: could be long with aggressive firewalls)
|
## Dump network routes with mtr and traceroute (warning: could be long with aggressive firewalls)
|
||||||
for addr in 8.8.8.8 www.evolix.fr travaux.evolix.net; do
|
network_targets="8.8.8.8 www.evolix.fr travaux.evolix.net"
|
||||||
mtr -r ${addr} > ${LOCAL_BACKUP_DIR}/mtr-${addr}
|
mtr_bin=$(command -v mtr)
|
||||||
traceroute -n ${addr} > ${LOCAL_BACKUP_DIR}/traceroute-${addr} 2>&1
|
if [ -n "${mtr_bin}" ]; then
|
||||||
done
|
for addr in ${network_targets}; do
|
||||||
|
${mtr_bin} -r ${addr} > ${LOCAL_BACKUP_DIR}/mtr-${addr}
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
traceroute_bin=$(command -v traceroute)
|
||||||
|
if [ -n "${traceroute_bin}" ]; then
|
||||||
|
for addr in ${network_targets}; do
|
||||||
|
${traceroute_bin} -n ${addr} > ${LOCAL_BACKUP_DIR}/traceroute-${addr} 2>&1
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
server_state_dir="${LOCAL_BACKUP_DIR}/server-state"
|
server_state_dir="${LOCAL_BACKUP_DIR}/server-state"
|
||||||
|
|
||||||
|
@ -598,8 +609,6 @@ export LC_ALL=C
|
||||||
|
|
||||||
# Error on unassigned variable
|
# Error on unassigned variable
|
||||||
set -u
|
set -u
|
||||||
# Fail if a pipeline member returns an error (cf. https://sipb.mit.edu/doc/safe-shell/)
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
# Default return-code (0 == succes)
|
# Default return-code (0 == succes)
|
||||||
rc=0
|
rc=0
|
||||||
|
|
Loading…
Reference in a new issue