Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Batch authentication with psql -- SOLVED

30 views
Skip to first unread message

David F. Skoll

unread,
Jul 29, 2002, 11:21:55 AM7/29/02
to
Hi,

I needed a way to supply a password to psql from shell scripts and
cron jobs, but didn't want to install "expect" -- too complex.

I wrote a simple little C program called "notty" which convinces psql
that it has no controlliny TTY, and then it reads the password from
stdin.

So instead of:

psql [options] < commands.sql

You use:

(echo "password"; cat commands.sql) | notty psql [options]

The C source code is at http://www.roaringpenguin.com/notty.c.txt

It is verified to work on Linux and Solaris, and should work on any
modern UNIX. On any decent UNIX system, you should be able to save
the file as "notty.c" and type:

make notty

to build it.

Regards,

David.


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majo...@postgresql.org

0 new messages