From d252ac64a0e75e6275e08f61becc1b01361d43d9 Mon Sep 17 00:00:00 2001 From: Norbert Varzariu Date: Mon, 25 Jan 2016 08:56:04 +0100 Subject: [PATCH] move PGPASSWD variable into ssh command (so it is available on the node) --- templates/psql.sh.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/psql.sh.erb b/templates/psql.sh.erb index 0f3f9ab..77fdd15 100644 --- a/templates/psql.sh.erb +++ b/templates/psql.sh.erb @@ -7,12 +7,12 @@ host=<%=@host%> user=<%=@dbbackup_user%> pass=<%=@dbbackup_password%> -PGPASSWORD="$pass" +#PGPASSWORD="$pass" dbs=( - $(ssh -l <%=@backup_user-%> "$host" "psql -U ${user} -Atc \"SELECT datname FROM pg_database WHERE NOT datistemplate AND NOT datname ~ '<%@ignore_dbs.each do |db|-%><%if db == @ignore_dbs.last-%><%=db-%><%else-%><%=db-%>|<%end-%><%end-%>'\"") + $(ssh -l <%=@backup_user-%> "$host" "PGPASSWORD=${pass} psql -U ${user} -Atc \"SELECT datname FROM pg_database WHERE NOT datistemplate AND NOT datname ~ '<%@ignore_dbs.each do |db|-%><%if db == @ignore_dbs.last-%><%=db-%><%else-%><%=db-%>|<%end-%><%end-%>'\"") ) for db in "${dbs[@]}"; do - ssh -l <%=@backup_user-%> "$host" "<%=@dumper-%> -U ${user} <%=@dump_flags-%> ${db}" > "$db".sql + ssh -l <%=@backup_user-%> "$host" "PGPASSWORD=${pass} <%=@dumper-%> -U ${user} <%=@dump_flags-%> ${db}" > "$db".sql wait <% if @compress != '' -%> <%=@compress-%> "$db".sql