LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-31-2003, 02:07 PM   #1
squadja
LQ Newbie
 
Registered: Jul 2003
Location: Hamilton
Distribution: Redhat 9.0
Posts: 7

Rep: Reputation: 0
postgres and setting the environment for PGDATA


hello,
Now that I have figured out how to send an attachment with crontab, I am attempting to add the backup procedure to the cronjob.

su postgres
pg_dumpall > test



and the error I keep getting is:
postgres does not know where to find the database system data. You must specify the directory that contains the database system either by specifying the -D invocation option or by setting the PGDATA environment variable.

HELP!!

Thanks
 
Old 08-13-2003, 03:28 PM   #2
jdruin
Member
 
Registered: Jul 2003
Location: Louisville aka Derby City
Distribution: WinXP SP2 and SP3, W2K Server, Ubuntu
Posts: 313

Rep: Reputation: 30
You could run the command as:

pg_dumpall -D /var/lib/pgsql/data > test

where /var/lib/pgsql/data is the path to your postgres data directory. THIS VARIES BY VERSION. you may find data located in /usr/local/pgsql/data or somewhere else. Do a

find / -name data

and see if one of these two places shows up.

You can then set the PGDATA variable in your /etc/profile so that when a user logs in, the path will be permanently set. Also I recommend setting up variables for log, port, etc so you can refer to these in other operations such as using pg_ctl. For example, in my /etc/profile I added these lines:

PGDATA="/var/lib/pgsql/data"
PGHOST="localhost"
PGPORT="5432"
PGLOG="/var/log/pgsql"

Note that these are specific to my installation. You can do a

find / -name pgsql

to see where the log is located. Note that you will get back lots of folders named pgsql. You are looking for the one that is a log file so you have to use your head. Doing a

ls -l

on the results can tell you which are files and which are folders. Then you can check the ones that are files to see which one is the log. Of course if you find a file in you /var/log named pgsql, your probably safe with that one [lol].

Once you get the variables set up in your /etc/profile, exit and log back in for them to tale effect. Test by doing a

cd $PGDATA

and see if you end up in your postgress data directory
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
environment setting problem nileshbirari Linux - Newbie 8 04-06-2006 07:14 AM
Setting Environment Variables rbh123 Linux - Newbie 2 10-03-2005 07:34 PM
Setting Environment Variables farzan Linux - Newbie 2 08-07-2004 10:13 AM
so confused about setting up environment ashley75 Linux - General 3 01-13-2004 12:51 PM
setting environment variables durden2.0 Linux - Newbie 5 07-15-2003 02:57 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration