pgAgent and pgpass
От | Barry Schatz |
---|---|
Тема | pgAgent and pgpass |
Дата | |
Msg-id | y2wc96428941004260956k9b3808e9jd1cf5cadee6fd911@mail.gmail.com обсуждение исходный текст |
Список | pgadmin-support |
First post here, hello all.<br /><br />I've run into a vexing problem where pgagent log reports:<br /><br />DEBUG: Creatingprimary connection<br />DEBUG: Creating DB connection: hostaddr=xx.xx.xxx.xxx port=6543 dbname=postgres user=postgres<br/> WARNING: Couldn't create connection: fe_sendauth: no password supplied<br />DEBUG: Clearing all connections<br/>DEBUG: Connection stats: total - 1, free - 0, deleted - 1<br /><br />This is occurring on a Debian Lennybox. I did not have this problem on a Gentoo box, but I was a little surprised that the Debian install of pgAgent doesnot provide an init script for pgAgent. I Googled extensively and couldn't find one, so I took the skeleton example from/etc/init.d and adapted from the Gentoo init script for pgAgent to produce this:<br /><br />#! /bin/sh<br />### BEGININIT INFO<br /># Provides: pgagent<br /># Required-Start: $local_fs $remote_fs $network $time<br />#Required-Stop: $local_fs $remote_fs $network $time<br /># Should-Start: $postgresql-8.4<br /> # Should-Stop: $postgresql-8.4<br /># Default-Start: 2 3 4 5<br /># Default-Stop: 0 1 6<br /># Short-Description: job scheduler for PostgreSQL<br />### END INIT INFO<br /><br /># Do NOT "set -e"<br /><br /># PATH shouldonly include /usr/* if it runs after the mountnfs.sh script<br />PATH=/sbin:/usr/sbin:/bin:/usr/bin<br />DESC="jobscheduler for PostgreSQL"<br />NAME=pgagent<br />DAEMON=/usr/bin/$NAME<br />DAEMON_ARGS="-l 2 -s /var/log/postgresql/pgagent.loghostaddr=xx.xx.xxx.xxxx port=6543 dbname=postgres user=postgres"<br /> PIDFILE=/var/run/$NAME.pid<br/>SCRIPTNAME=/etc/init.d/$NAME<br />PGUSER=postgres<br /><br /># Exit if the package is notinstalled<br />[ -x "$DAEMON" ] || exit 0<br /><br /># Read configuration variable file if it is present<br /> [ -r /etc/default/$NAME] && . /etc/default/$NAME<br /><br /># Load the VERBOSE setting and other rcS variables<br />./lib/init/vars.sh<br /><br /># Define LSB log_* functions.<br /># Depend on lsb-base (>= 3.0-6) to ensure that thisfile is present.<br /> . /lib/lsb/init-functions<br /><br />#<br /># Function that starts the daemon/service<br />#<br/>do_start()<br />{<br /> # Return<br /> # 0 if daemon has been started<br /> # 1 if daemonwas already running<br /> # 2 if daemon could not be started<br /> start-stop-daemon --start --quiet--chuid $PGUSER --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \<br /> || return 1<br /> start-stop-daemon --start --quiet --chuid $PGUSER --pidfile $PIDFILE --exec $DAEMON -- \<br /> $DAEMON_ARGS\<br /> || return 2<br /> # Add code here, if necessary, that waits for the process tobe ready<br /> # to handle requests from services started subsequently which depend<br /> # on this one. As a last resort, sleep for some time.<br />}<br /># TRUNCATED HERE<br /><br />Note the "--chuid $PGUSER" option. Thisworks, as "ps aux |grep pgagent" shows pgagent running under the postgres user. The .pgpass file is located correctlyin the postgres user home directory /var/lib/postgresql YET when pgagent runs it does not read the .pgpass filein its own user directory as it does with the Gentoo init script.<br /><br />This is my first init script on Debian butnot my first bash script and I cannot work out why the .pgpass file is not being read.<br /><br />All suggestions aregratefully welcome!<br />
В списке pgadmin-support по дате отправления: