shellcheck fixes

This commit is contained in:
Jérémy Lecour 2019-03-31 21:30:07 +02:00
parent b1f46bc866
commit 1376771e83

View file

@ -2,7 +2,7 @@
#
# Script Evobackup client
# See https://gitea.evolix.org/evolix/evobackup
#
#
# Author: Gregory Colpart <reg@evolix.fr>
# Contributors:
# Romain Dessort <rdessort@evolix.fr>
@ -42,6 +42,7 @@ if [ -e $PIDFILE ]; then
echo "$0 tourne encore (PID $pid). Processus killé" >&2
fi
echo "$$" > $PIDFILE
# shellcheck disable=SC2064
trap "rm -f $PIDFILE" EXIT
# email adress for notifications
@ -55,12 +56,12 @@ SSH_CONNECT_TIMEOUT=10
test_server() {
item=$1
host=$(echo ${item} | cut -d':' -f1)
port=$(echo ${item} | cut -d':' -f2)
host=$(echo "${item}" | cut -d':' -f1)
port=$(echo "${item}" | cut -d':' -f2)
# Test if the server is accepting connections
ssh -q -o "ConnectTimeout ${SSH_CONNECT_TIMEOUT}" ${host} -p ${port} -t "exit"
ssh -q -o "ConnectTimeout ${SSH_CONNECT_TIMEOUT}" "${host}" -p "${port}" -t "exit"
# shellcheck disable=SC2181
if [ $? = 0 ]; then
return 0
else
@ -78,7 +79,7 @@ pick_server() {
fi
salt=$(hostname | cksum | cut -d' ' -f1)
item=$(echo $(( ($(date +%d) + salt + inc) % list_length )))
item=$(( ($(date +%d) + salt + inc) % list_length ))
field=$(( item + 1 ))
echo "${SERVERS}" | cut -d' ' -f${field}
@ -98,11 +99,11 @@ while :; do
fi
done
SSH_SERVER=$(echo $SERVER | cut -d':' -f1)
SSH_PORT=$(echo $SERVER | cut -d':' -f2)
SSH_SERVER=$(echo "${SERVER}" | cut -d':' -f1)
SSH_PORT=$(echo "${SERVER}" | cut -d':' -f2)
## We use /home/backup : feel free to use your own dir
LOCAL_BACKUP_DIR=/home/backup
LOCAL_BACKUP_DIR="/home/backup"
# shellcheck disable=SC2174
mkdir -p -m 700 ${LOCAL_BACKUP_DIR}
@ -285,7 +286,7 @@ rsync -avzh --stats --delete --delete-excluded --force --ignore-errors --partial
--exclude "/var/lib/clamav/*.tmp" \
--exclude "/home/mysqltmp" \
--exclude "/var/lib/php/sessions" \
${rep} \
"${rep}" \
/etc \
/root \
/var \