Re: chron scripts and pgsql - Mailing list pgsql-general

From Ken Godee
Subject Re: chron scripts and pgsql
Date
Msg-id 3E913C1C.15276.352EA6@localhost
Whole thread Raw
In response to chron scripts and pgsql  (Dennis Gearon <gearond@cvc.net>)
List pgsql-general
su - ken -c "psql -d pi -f  update.sql >> update.log"

Since your cron file is run as root it can su to any user and as
long as user ken has rights for the database your connecting to
you don't need to enter any passwords.
This is how I do it and then from the same script I call a python
script to read in results from update.log and email them to me.

> 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@postgresql.org so that your
> message can get through to the mailing list cleanly
>


pgsql-general by date:

Previous
From: Jan Wieck
Date:
Subject: Re: unable to dump database, toast errors
Next
From: "Dan Langille"
Date:
Subject: Re: possible time change issue - known problem?