From: | "David F(dot) Skoll" <dfs(at)roaringpenguin(dot)com> |
---|---|
To: | pgsql-admin(at)postgresql(dot)org |
Subject: | Batch authentication with psql -- SOLVED |
Date: | 2002-07-29 15:21:54 |
Message-ID: | Pine.LNX.4.44.0207291117130.2557-100000@shishi.roaringpenguin.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
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.
From | Date | Subject | |
---|---|---|---|
Next Message | Jan Hartmann | 2002-07-29 16:43:26 | Re: Multiple Postmasters on Beowulf cluster |
Previous Message | Joe | 2002-07-29 14:35:27 | Re: Could not connect to remote socket |