summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2015-12-23 21:17:05 -0700
committermo khan <mo@mokhan.ca>2015-12-23 21:17:05 -0700
commit6f43e9640de5a43982b8f6a124276db0c08c84d3 (patch)
tree84a23991b5b699920765ed763a5868f205faee92
parent64fa7974190d772589f6390826a3be396c5e6da7 (diff)
export PG variables for cron job.
-rw-r--r--recipes/postgres.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/recipes/postgres.rb b/recipes/postgres.rb
index bf986db..849738a 100644
--- a/recipes/postgres.rb
+++ b/recipes/postgres.rb
@@ -48,7 +48,7 @@ end
template "/etc/postgresql/pg_backup.config" do
user "postgres"
group "postgres"
- variables(backup_dir: backups_dir)
+ variables(backup_dir: "#{backups_dir}/")
end
file "/var/lib/postgresql/.pgpass" do
@@ -59,6 +59,10 @@ end
cron 'pg_backups' do
action :create
command "#{backups_dir}/pg_backup_rotated.sh -c /etc/postgresql/pg_backup.config"
+ environment({
+ "PGPASSFILE" => "/var/lib/postgresql/.pgpass",
+ "PGPASSWORD" => node["postgresql"]["password"]["postgres"],
+ })
hour '1'
minute '0'
user 'postgres'