From: | Ken Harris <kharris(at)lhinfo(dot)com> |
---|---|
To: | Dennis Gearon <gearond(at)cvc(dot)net> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: chron scripts and pgsql |
Date: | 2003-04-07 11:31:20 |
Message-ID: | 1049715080.3e91618885ee7@www.lhinfo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
My instance of postgres runs on a separate box than the one that does the work.
So connections are always via TCP/IP. Therefore, the simple "psql -c
<command>" doesn't work because my databases require a username/password. My
solution for the cron scripts (the only one I could figure out that works). My
database name and password are stored in a file readable only by the script
execution id. Those filenames and passwords are parsed and set to the PGUSER
and PGPASSWORD variables (which exist only for the life of the script). I can
then run my "pgsql -h <hostname> -c <command>" for any and all databases.
If anyone has a better solution for the username/password, I would love to see
it, but this works.
Hope this helps,
--
Ken Harris
Senior Consultant
http://www.lhinfo.com
(410) 597-8916
Quoting Dennis Gearon <gearond(at)cvc(dot)net>:
> OOPS,
>
> 'chron' != 'cron'
>
> There's maybe 'one or two more' than I found before, using 'cron'
> instead :-)
>
> Dennis Gearon wrote:
> >
> > I looked in postgres-general, and VERY little came up about 'chron'.
> >
> > Can anyone outline what it takes not NON INTERACTIVELY do a query with
> > pgsql? So it can be done in a chron script?
> >
> > I want to check a table to see if there's any rows with 'unapproved' in
> > one column and then just call mail to send someone an email to approve
> > some listings.
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 3: if posting/reading through Usenet, please send an appropriate
> > subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> > message can get through to the mailing list cleanly
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>
-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/
From | Date | Subject | |
---|---|---|---|
Next Message | Jan Wieck | 2003-04-07 11:34:47 | Re: unable to dump database, toast errors |
Previous Message | Justin Clift | 2003-04-07 10:34:05 | Postgresql & AMD x86-64 |