pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Kerr <dmk@mr-paradox.net>
To: Patrick Lademan <mjfrog14@gmail.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: Postgres jobs will not automatically login on Mac OSX
Date: Fri, 22 Nov 2013 09:35:22 -0800
Message-ID: <20131122173521.GA95470@mr-paradox.net> (raw)
In-Reply-To: <CADMm_6BDnW6DfMve0yj75U70La1ZHXYSoErWe848u3+QcZFYdw@mail.gmail.com>
References: <CADMm_6Ay7M4=QHcvsYG-iYbSwPsCP-DmaXjZBivp4Unhe=mVPQ@mail.gmail.com>
	<7470.1385055223@sss.pgh.pa.us>
	<CADMm_6BqFQ3ZMfcYE2B9cJf0wZ0mpUE2n+dA3gp19f=KraQ3fg@mail.gmail.com>
	<7447.1385062922@sss.pgh.pa.us>
	<CADMm_6AG-bWJMZmorCgB3Fxpo4nSRLJP3-MsPTJnnWHQA9m=7Q@mail.gmail.com>
	<528E8AF6.3090808@timbira.com.br>
	<CADMm_6BDnW6DfMve0yj75U70La1ZHXYSoErWe848u3+QcZFYdw@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

On Thu, Nov 21, 2013 at 07:11:46PM -0500, Patrick Lademan wrote:
- That worked!!!  Thanks!!!
- 
- I have one last problem.
- 
- It works correctly at the command line:
- postgres ~
- $ ./pg_backup.sh
- 
- User: postgres
- PWD:  /Library/PostgreSQL/9.3
- HOME: /Library/PostgreSQL/9.3
- BACKUP_DIR: /Users/backup/postgres/
- BACKUP_DIR_DATED: /Users/backup/postgres/2013-11-21/
- ----- Full backups Begin -----
- Backing up postgres   ---> /Users/backup/postgres/2013-11-21/postgres.sql.gz
- Backing up rincon   ---> /Users/backup/postgres/2013-11-21/rincon.sql.gz
- ----- Full backups End -----
- 
- When I run it as a job in postgres, it fails.  Here are the results:
- 662 Failed 1 Thu Nov 21 19:02:38 2013 Thu Nov 21 19:02:38 2013
- 00:00:00.016344
- User: postgres
- PWD:  /Library/PostgreSQL/9.3
- HOME: /Library/PostgreSQL/9.3
- BACKUP_DIR: /Users/backup/postgres/
- BACKUP_DIR_DATED: /Users/backup/postgres/2013-11-21/
- ----- Full backups Begin -----
- No schemas returned from database.  This could be a password issue.
- 
- It is behaving like it could not login to get the schema list.
- Since prompting for a password is not an error message, it is not displayed
- in the error log.
- How can I debug this job?


As a sanity check you might want to add the following to the if statement.
echo "Hostname: ${HOSTNAME}"
echo "Username: ${USERNAME}"

Those may be getting lost when the job is run via cron.

For example:
# If the list of Schemas is empty, display error and abort
if [ "$FULL_BACKUP_QUERY_LIST" = "" ]; then
  echo "Hostname: ${HOSTNAME}"		# <-------Add
  echo "Username: ${USERNAME}"		# <-------Add
  echo -e "No schemas returned from database.  This could be a password
issue."
  exit 1
fi

Alternativly, add -x to the top line to enable debugging
#!/bin/bash -x

and then in your cron job output stdout and stderr to a file
0 0 0 0 0 0 backupjob.sh >/tmp/backup.out 2>&1


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (8+ messages)  latest in thread

Message-ID: <20131122173521.GA95470@mr-paradox.net>
Permalink:  ../20131122173521.GA95470@mr-paradox.net/
Also on:    postgresql.org/message-id/20131122173521.GA95470@mr-paradox.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: dmk@mr-paradox.net, mjfrog14@gmail.com
  Subject: Re: Postgres jobs will not automatically login on Mac OSX
  In-Reply-To: <20131122173521.GA95470@mr-paradox.net>
  References: <CADMm_6Ay7M4=QHcvsYG-iYbSwPsCP-DmaXjZBivp4Unhe=mVPQ@mail.gmail.com> <7470.1385055223@sss.pgh.pa.us> <CADMm_6BqFQ3ZMfcYE2B9cJf0wZ0mpUE2n+dA3gp19f=KraQ3fg@mail.gmail.com> <7447.1385062922@sss.pgh.pa.us> <CADMm_6AG-bWJMZmorCgB3Fxpo4nSRLJP3-MsPTJnnWHQA9m=7Q@mail.gmail.com> <528E8AF6.3090808@timbira.com.br> <CADMm_6BDnW6DfMve0yj75U70La1ZHXYSoErWe848u3+QcZFYdw@mail.gmail.com> <20131122173521.GA95470@mr-paradox.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox