WebFaction
Community site: login faq

Having issues running python script via cron that executes pg_dump. Always get "permission denied". Have tried setting up .pgpass in home directory (script works at command line this way), but assume this file not found when run by cron. Have tried prepending PGPASSFILE=/path/to/.pgpass in cron in front of command, have tried modifying os.environ to include PGPASSFILE or PGPASSWORD in the script, nothing is working. Any tips?

asked 27 Oct '15, 02:08

cstrombe
112
accept rate: 0%

Can you edit your question to include the code for review?

(27 Oct '15, 03:10) ryans ♦♦

I got it working! Was a simple issue, of course, related to cron. First, I had forgotten to chmod the script to make it executable, which is why I was seeing "permission denied", which I mistakenly thought was related to the postgres credentials. So, setting the password via os.environ['PGPASSWORD'] in the script is working.

Thanks for the reply ryans, it's what forced me to go back and actually review my script before posting, which led me to find the issue.

permanent link

answered 27 Oct '15, 14:14

cstrombe
112
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×337
×108
×81

question asked: 27 Oct '15, 02:08

question was seen: 1,443 times

last updated: 27 Oct '15, 14:14

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM