Re: data copy script - Mailing list pgsql-novice

From Ron St-Pierre
Subject Re: data copy script
Date
Msg-id 416C3CCA.9000307@syscor.com
Whole thread Raw
In response to data copy script  ("Keith Worthington" <keithw@narrowpathinc.com>)
List pgsql-novice
Keith Worthington wrote:

>Hi All,
>
>I need to write a shell script that can be run by cron to automatically load
>data into a PostgreSQL database.  I have been experimenting with the copy
>command in psql and I have a few questions.
>
>How can I run a copy command from a script?
>
You can either run the command directly from postgres' cron:
   0       22      *       *       *       /usr/local/pgsql/bin/pgsql -p
5432 -d imperial -c" COPY dataTable FROM 'fileName' WITH NULL AS '';"
or place the script inside of a file and have cron call it using
something like:
   0       22      *       *       *       sh
/usr/local/pgsql/myShellScript.sh

Ron

>What is the usage for the copy command when getting data from stdin?
>
>Kind Regards,
>Keith
>
>______________________________________________
>99main Internet Services http://www.99main.com
>
>
>---------------------------(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-novice by date:

Previous
From: Daniel Lerch
Date:
Subject: Re: possible to access a Linux box db from a Windows box
Next
From: Antoine
Date:
Subject: Re: possible to access a Linux box db from a Windows box