Re: [GENERAL] Starting postmaster at boot

2000-09-14 Thread David Veatch

At 03:20 PM 9/14/00 -0400, Adam Lang wrote:
 I'm still having difficulties getting postgres to start on boot.
 
 Any chance someone can give me an example of how they have it on their
 system?
 
 
 (Seemed to have been lost in the list being down).
 
 Adam Lang
 Systems Engineer
 Rutgers Casualty Insurance Company

Haven't done much looking into it for efficiency or anything like that, but 
here's what I have in my rc.local file (FreeBSD 3.2).  Hope it helps!


#!/bin/sh
[ -x /usr/local/pgsql/bin/postmaster ]  {
 su -l postgres -c 'exec /usr/local/pgsql/bin/postmaster -D 
/usr/local/pgsql/data -S -o -F -N 48 -B 96 /home/postgres/postgres.log' 
 echo -n ' postgres'
}

David Veatch - [EMAIL PROTECTED]

"Many people would sooner die than think.
In fact, they do." - Bertrand Russell




Re: [GENERAL] Starting postmaster at boot

2000-09-14 Thread Adam Lang

Does it work the same for linux?

Adam Lang
Systems Engineer
Rutgers Casualty Insurance Company
- Original Message -
From: "David Veatch" [EMAIL PROTECTED]
To: "Adam Lang" [EMAIL PROTECTED]; "PGSQL General"
[EMAIL PROTECTED]
Sent: Thursday, September 14, 2000 3:29 PM
Subject: Re: [GENERAL] Starting postmaster at boot


 At 03:20 PM 9/14/00 -0400, Adam Lang wrote:
  I'm still having difficulties getting postgres to start on boot.
  
  Any chance someone can give me an example of how they have it on their
  system?
  
  
  (Seemed to have been lost in the list being down).
  
  Adam Lang
  Systems Engineer
  Rutgers Casualty Insurance Company

 Haven't done much looking into it for efficiency or anything like that,
but
 here's what I have in my rc.local file (FreeBSD 3.2).  Hope it helps!


 #!/bin/sh
 [ -x /usr/local/pgsql/bin/postmaster ]  {
  su -l postgres -c 'exec /usr/local/pgsql/bin/postmaster -D
 /usr/local/pgsql/data -S -o -F -N 48 -B 96 /home/postgres/postgres.log' 
  echo -n ' postgres'
 }

 David Veatch - [EMAIL PROTECTED]

 "Many people would sooner die than think.
 In fact, they do." - Bertrand Russell




Re: [GENERAL] Starting postmaster at boot

2000-09-14 Thread David Veatch

At 03:31 PM 9/14/00 -0400, Adam Lang wrote:
 Does it work the same for linux?

It's basic sh, so I can only assume that it does, though I should stress 
that I don't run Linux, and haven't sat at a Linux command prompt in over a 
year... so I can't say it does with 100% certainty.  The sh syntax should 
port, and if the Linux port of Postgres supports the same arguments as the 
FreeBSD port, then that should work as well...

David Veatch - [EMAIL PROTECTED]

"Many people would sooner die than think.
In fact, they do." - Bertrand Russell




Re: [GENERAL] Starting postmaster at boot

2000-09-14 Thread Adam Lang

I didn't directly use your method, but you nonetheless solved my problem.
From the beginning everyone was telling me to put this into my rc.local:
su postgres -c "/usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data -i
/usr/local/pgsql/postgres.log 21 "

It was never working.  I noticed you had a tag "-l" in yours for su.  I
looked up the reason for it and gave it a try.  So the script:
su -l postgres -c "/usr/local/pgsql/bin/postmaster -D
/usr/local/pgsql/data -i /home/postgres/postgres.log 21 "
does work.

I still don't understand the point of the 1's and 2's in the command though.

Why is everyone else's script working without the -l and mine wasn't?

Thanks.

Adam Lang
Systems Engineer
Rutgers Casualty Insurance Company
- Original Message -
From: "David Veatch" [EMAIL PROTECTED]
To: "Adam Lang" [EMAIL PROTECTED]; "PGSQL General"
[EMAIL PROTECTED]
Sent: Thursday, September 14, 2000 3:29 PM
Subject: Re: [GENERAL] Starting postmaster at boot


 At 03:20 PM 9/14/00 -0400, Adam Lang wrote:
  I'm still having difficulties getting postgres to start on boot.
  
  Any chance someone can give me an example of how they have it on their
  system?
  
  
  (Seemed to have been lost in the list being down).
  
  Adam Lang
  Systems Engineer
  Rutgers Casualty Insurance Company

 Haven't done much looking into it for efficiency or anything like that,
but
 here's what I have in my rc.local file (FreeBSD 3.2).  Hope it helps!


 #!/bin/sh
 [ -x /usr/local/pgsql/bin/postmaster ]  {
  su -l postgres -c 'exec /usr/local/pgsql/bin/postmaster -D
 /usr/local/pgsql/data -S -o -F -N 48 -B 96 /home/postgres/postgres.log' 
  echo -n ' postgres'
 }

 David Veatch - [EMAIL PROTECTED]

 "Many people would sooner die than think.
 In fact, they do." - Bertrand Russell




Re: [GENERAL] Starting postmaster at boot

2000-09-14 Thread Alfred Perlstein

* Adam Lang [EMAIL PROTECTED] [000914 13:21] wrote:
 I didn't directly use your method, but you nonetheless solved my problem.
 From the beginning everyone was telling me to put this into my rc.local:
 su postgres -c "/usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data -i
 /usr/local/pgsql/postgres.log 21 "
 
 It was never working.  I noticed you had a tag "-l" in yours for su.  I
 looked up the reason for it and gave it a try.  So the script:
 su -l postgres -c "/usr/local/pgsql/bin/postmaster -D
 /usr/local/pgsql/data -i /home/postgres/postgres.log 21 "
 does work.
 
 I still don't understand the point of the 1's and 2's in the command though.

It tells the shell to hook the child's stderr to stdout so that all
output should go to /home/postgres/postgres.log.

 Why is everyone else's script working without the -l and mine wasn't?

Check su's manpage.

-- 
-Alfred Perlstein - [[EMAIL PROTECTED]|[EMAIL PROTECTED]]
"I have the heart of a child; I keep it in a jar on my desk."



Re: [GENERAL] Starting postmaster at boot

2000-09-14 Thread Dale Walker

Adam Lang wrote:
 
 I didn't directly use your method, but you nonetheless solved my problem.
 From the beginning everyone was telling me to put this into my rc.local:
 su postgres -c "/usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data -i
 /usr/local/pgsql/postgres.log 21 "
 
 It was never working.  I noticed you had a tag "-l" in yours for su.  I
 looked up the reason for it and gave it a try.  So the script:
 su -l postgres -c "/usr/local/pgsql/bin/postmaster -D
 /usr/local/pgsql/data -i /home/postgres/postgres.log 21 "
 does work.
 
 I still don't understand the point of the 1's and 2's in the command though.


it's a method for redirecting STDERR -- STDOUT

this is especially usefull in scripts 

normally I use [scriptname /dev/null 21] to send any unwanted output
to /dev/null

 
 Why is everyone else's script working without the -l and mine wasn't?
 


'-l' uses the login profile for the su'd user... this is similar to a
'simuated login', without it , it was only referencing variables from
your roo profile ... (ie. no PGDATA,etc..)


-- 
Dale Walker  [EMAIL PROTECTED]
Independent Computer Retailers (ICR)   http://www.icr.com.au
ICRnet http://www.icr.net.au



Re: [GENERAL] Starting postmaster at boot

2000-09-14 Thread Adam Lang

oh... so since I did a su -l, I could have just used the command,
postmaster -i postgres.log 21  ? Since I had the appropriate variables
in postgres's .bash_profile?

Adam Lang
Systems Engineer
Rutgers Casualty Insurance Company
- Original Message -
From: "Dale Walker" [EMAIL PROTECTED]
To: "Adam Lang" [EMAIL PROTECTED]
Cc: "PGSQL General" [EMAIL PROTECTED]
Sent: Thursday, September 14, 2000 4:33 PM
Subject: Re: [GENERAL] Starting postmaster at boot


 Adam Lang wrote:
 
  I didn't directly use your method, but you nonetheless solved my
problem.
  From the beginning everyone was telling me to put this into my
rc.local:
  su postgres -c "/usr/local/pgsql/bin/postmaster -D
/usr/local/pgsql/data -i
  /usr/local/pgsql/postgres.log 21 "
 
  It was never working.  I noticed you had a tag "-l" in yours for su.  I
  looked up the reason for it and gave it a try.  So the script:
  su -l postgres -c "/usr/local/pgsql/bin/postmaster -D
  /usr/local/pgsql/data -i /home/postgres/postgres.log 21 "
  does work.
 
  I still don't understand the point of the 1's and 2's in the command
though.


 it's a method for redirecting STDERR -- STDOUT

 this is especially usefull in scripts

 normally I use [scriptname /dev/null 21] to send any unwanted output
 to /dev/null

 
  Why is everyone else's script working without the -l and mine wasn't?
 


 '-l' uses the login profile for the su'd user... this is similar to a
 'simuated login', without it , it was only referencing variables from
 your roo profile ... (ie. no PGDATA,etc..)


 --
 Dale Walker  [EMAIL PROTECTED]
 Independent Computer Retailers (ICR)   http://www.icr.com.au
 ICRnethttp://www.icr.net.au




Re: [GENERAL] Starting postmaster at boot

2000-09-14 Thread Mitch Vincent

The reason I didn't have to use the -l is that I have everything PostgreSQL
needs (as far as environment variables) already set, because this machine is
a dedicated PostgreSQL server.

Sorry, should have thought about that before I replied but it seems you have
it running now, that's great.. Good luck!

-Mitch

- Original Message -
From: "Dale Walker" [EMAIL PROTECTED]
To: "Adam Lang" [EMAIL PROTECTED]
Cc: "PGSQL General" [EMAIL PROTECTED]
Sent: Thursday, September 14, 2000 1:33 PM
Subject: Re: [GENERAL] Starting postmaster at boot


 Adam Lang wrote:
 
  I didn't directly use your method, but you nonetheless solved my
problem.
  From the beginning everyone was telling me to put this into my
rc.local:
  su postgres -c "/usr/local/pgsql/bin/postmaster -D
/usr/local/pgsql/data -i
  /usr/local/pgsql/postgres.log 21 "
 
  It was never working.  I noticed you had a tag "-l" in yours for su.  I
  looked up the reason for it and gave it a try.  So the script:
  su -l postgres -c "/usr/local/pgsql/bin/postmaster -D
  /usr/local/pgsql/data -i /home/postgres/postgres.log 21 "
  does work.
 
  I still don't understand the point of the 1's and 2's in the command
though.


 it's a method for redirecting STDERR -- STDOUT

 this is especially usefull in scripts

 normally I use [scriptname /dev/null 21] to send any unwanted output
 to /dev/null

 
  Why is everyone else's script working without the -l and mine wasn't?
 


 '-l' uses the login profile for the su'd user... this is similar to a
 'simuated login', without it , it was only referencing variables from
 your roo profile ... (ie. no PGDATA,etc..)


 --
 Dale Walker  [EMAIL PROTECTED]
 Independent Computer Retailers (ICR)   http://www.icr.com.au
 ICRnethttp://www.icr.net.au





Re: [GENERAL] Starting postmaster at boot

2000-09-14 Thread Adam Lang

OH! I get it.  Whereas I have the environment variables in postgres's
.bash_profile, you have it set where those variables are loaded for all
users, correct?

But the part that I don't get is that (typing it at console) I can start
postgresql (while logged in as postgres) with the command: postmaster -i
because I have the variables for the location of postmaster and pgdata set.

But, I would assume that typing the absolute paths would have gotten around
that for when I was doing the su.  Are there other environment variables I
didn't take insto consideration?


Adam Lang
Systems Engineer
Rutgers Casualty Insurance Company
- Original Message -
From: "Mitch Vincent" [EMAIL PROTECTED]
To: "Adam Lang" [EMAIL PROTECTED]
Cc: "PGSQL General" [EMAIL PROTECTED]
Sent: Thursday, September 14, 2000 4:40 PM
Subject: Re: [GENERAL] Starting postmaster at boot


 The reason I didn't have to use the -l is that I have everything
PostgreSQL
 needs (as far as environment variables) already set, because this machine
is
 a dedicated PostgreSQL server.

 Sorry, should have thought about that before I replied but it seems you
have
 it running now, that's great.. Good luck!

 -Mitch

 - Original Message -
 From: "Dale Walker" [EMAIL PROTECTED]
 To: "Adam Lang" [EMAIL PROTECTED]
 Cc: "PGSQL General" [EMAIL PROTECTED]
 Sent: Thursday, September 14, 2000 1:33 PM
 Subject: Re: [GENERAL] Starting postmaster at boot


  Adam Lang wrote:
  
   I didn't directly use your method, but you nonetheless solved my
 problem.
   From the beginning everyone was telling me to put this into my
 rc.local:
   su postgres -c "/usr/local/pgsql/bin/postmaster -D
 /usr/local/pgsql/data -i
   /usr/local/pgsql/postgres.log 21 "
  
   It was never working.  I noticed you had a tag "-l" in yours for su.
I
   looked up the reason for it and gave it a try.  So the script:
   su -l postgres -c "/usr/local/pgsql/bin/postmaster -D
   /usr/local/pgsql/data -i /home/postgres/postgres.log 21 "
   does work.
  
   I still don't understand the point of the 1's and 2's in the command
 though.
 
 
  it's a method for redirecting STDERR -- STDOUT
 
  this is especially usefull in scripts
 
  normally I use [scriptname /dev/null 21] to send any unwanted output
  to /dev/null
 
  
   Why is everyone else's script working without the -l and mine wasn't?
  
 
 
  '-l' uses the login profile for the su'd user... this is similar to a
  'simuated login', without it , it was only referencing variables from
  your roo profile ... (ie. no PGDATA,etc..)
 
 
  --
  Dale Walker  [EMAIL PROTECTED]
  Independent Computer Retailers (ICR)   http://www.icr.com.au
  ICRnethttp://www.icr.net.au