2 Commits eedfa5d1f0 ... ea6e6d2334

Author SHA1 Message Date
  Emmanuel Bouthenot ea6e6d2334 Explicitely use -n option used with tail 1 year ago
  Emmanuel Bouthenot d810ac7829 Improve error handling in encryption and compression 1 year ago
1 changed files with 4 additions and 4 deletions
  1. 4 4
      autopostgresqlbackup

+ 4 - 4
autopostgresqlbackup

@@ -380,7 +380,7 @@ dbdump () {
 # {{{ encryption()
 encryption() {
     log_debug "Encrypting using public key ${ENCRYPTION_PUBLIC_KEY}"
-    gpg --homedir "${GPG_HOMEDIR}" --encrypt --passphrase-file /dev/null --recipient-file "${ENCRYPTION_PUBLIC_KEY}" 2>&7
+    gpg --homedir "${GPG_HOMEDIR}" --encrypt --passphrase-file /dev/null --recipient-file "${ENCRYPTION_PUBLIC_KEY}" 2> >(logger "err" "error")
 }
 # }}}
 
@@ -389,10 +389,10 @@ compression () {
     if [ -n "${COMP_OPTS}" ]; then
         IFS=" " read -r -a comp_args <<< "${COMP_OPTS}"
         log_debug "Compressing using '${COMP} ${comp_args[*]}'"
-        "${COMP}" "${comp_args[@]}" 2>&7
+        "${COMP}" "${comp_args[@]}" 2> >(logger "err" "error")
     else
         log_debug "Compressing using '${COMP}'"
-        "${COMP}" 2>&7
+        "${COMP}" 2> >(logger "err" "error")
     fi
 }
 # }}}
@@ -475,7 +475,7 @@ cleanup() {
         sed -r 's/^.+([0-9]{4}-[0-9]{2}-[0-9]{2}_[0-9]{2}h[0-9]{2}m).*$/\1 \0/' | \
         sort -r | \
         sed -r -n 's/\S+ //p' | \
-        tail "+${count}" | \
+        tail -n "+${count}" | \
         xargs -L1 rm -fv | \
         while IFS= read -r line ; do
             log_info "${line}"