Re: Juvenile BASH question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 21 Oct 2013, Mark Haney wrote:


This may sound like a rather juvenile BASH question, but I'm rather stumped and hope it's something simple to fix.  I hope someone has the answer since I
don't really have time (swapping out firewalls and half my network is down) to research it. 

 

I have a BASH script that is pretty simple, it backs up postgresQL databases using pg_dump.  It runs as root since I am copying data to a SAN and don't
really want to configure the postgres user to have access to it.  But, in order to get everything dumped properly, I do this:

 

su postgres - -c <pgdump command>

 

Now, this has worked perfectly for 3 months now, but the last few days I started getting errors about failed authentication to the databases.  Here's
where it gets weird.  I can su postgres - from a BASH prompt just fine,but when I run the script, it asks me for a password, which it didn't do before. 
IIRC, I had to change the postgres user from /bin/false to /bin/bash for one of our software devs to be able to monitor the DBs via Jenkins, could that
have something to do with it?  I can't imagine how, since I can su from the root prompt to the postgres user without asking for a password. 

 

Help!

 

It's been awhile since I used postgres, having moved to mysql, but if it's asking for the postgres admin password rather than root password, can't you get around it by putting it in a file somewhere like .pgpass or setting an environment variable like PGPASSWORD?  Maybe you need to set that in the shell you are created.  See:
http://www.postgresql.org/docs/9.1/static/libpq-envars.html
and http://stackoverflow.com/questions/6523019/postgresql-scripting-psql-execution-with-password


billo
-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux