瀏覽代碼

Improve error handling in encryption and compression

Emmanuel Bouthenot 1 年之前
父節點
當前提交
d810ac7829
共有 1 個文件被更改,包括 3 次插入3 次删除
  1. 3 3
      autopostgresqlbackup

+ 3 - 3
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
 }
 # }}}