Thread: Re: [PATCHES] A Sparc/Linux patch (for 7.1), and a Linux rc.d/init.d script....

Re: [PATCHES] A Sparc/Linux patch (for 7.1), and a Linux rc.d/init.d script....

From
Peter Eisentraut
Date:
Ryan Kirkpatrick writes:

>     postgresql -> This is a Linux distribution independent (or so I
> hope) init.d/rc.d script that makes use of pg_ctl. There is currently a
> few in ./contrib/linux of the pgsql source tree, but they are RedHat
> specific. This one is simple and self contained. Might be worth adding to
> the other scripts.

I don't see how this can be more independent if it uses

DAEMON=/home/postgres/bin/pg_ctl

and

LOG="/usr/local/pgsql/server.log"

Nor is

su - postgres sh -c "$DAEMON stop >& /dev/null"

an appropriate way to stop the server in a system shutdown situation.


IMHO, rather than accumulating a bunch of versions that somebody liked
better than the existing ones, why not provide actual scripts from actual
distributions?  Generic scripts will just lead to generic problems.

-- 
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/



> LOG="/usr/local/pgsql/server.log"
> 
> Nor is
> 
> su - postgres sh -c "$DAEMON stop >& /dev/null"

Also, >& is not standard either.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


Re: [PATCHES] A Sparc/Linux patch (for 7.1), and a Linux rc.d/init.d script....

From
Ryan Kirkpatrick
Date:
On Sun, 4 Feb 2001, Peter Eisentraut wrote:

> Ryan Kirkpatrick writes:
> 
> >     postgresql -> This is a Linux distribution independent (or so I
> > hope) init.d/rc.d script that makes use of pg_ctl. There is currently a
> > few in ./contrib/linux of the pgsql source tree, but they are RedHat
> > specific. This one is simple and self contained. Might be worth adding to
> > the other scripts.
> 
> I don't see how this can be more independent if it uses
> 
> DAEMON=/home/postgres/bin/pg_ctl
Ooops.... That is my mistake... Should have been
/usr/local/pgsql/bin/pg_ctl. I have /usr/local/pgsql/ symlinked to /home
(where there is more, faster disk space). I can submit a patch, or can
some one just fix it?

> LOG="/usr/local/pgsql/server.log"
What is wrong with that? There really is no standard on where to
put the log file, so it is either here or /var/log.

> su - postgres sh -c "$DAEMON stop >& /dev/null"
Hmm... What is wrong here, besides the '>&'? The '>&' can be
replaced with '2>&1 >' if that is more standard.

> an appropriate way to stop the server in a system shutdown situation.
Uh... Isn't that the way you are supposed to stop it? pg_ctl stop?

> IMHO, rather than accumulating a bunch of versions that somebody liked
> better than the existing ones, why not provide actual scripts from actual
> distributions?  Generic scripts will just lead to generic problems.
Fine by me... I just put mine up as a suggestion, as the only
other one in contrib was very RH specific. The one included with the
debian package is very debian specific (and over complex in IMHO). I just
submitted mine as a possible generic Linux version that should work with
bash on most installation. If some one has a better idea, then by all
means post it.Also, from the way I understand contrib, they are user submissions
and are in no way assured to work on any other machine than the user's who
submitted it. I take it as given anything in contrib might need a bit of
editing to fit my needs.Anyway, just my response as one who has used Slackware, RedHat,
and now Debian over the years, but who in no way claims to be an
uber-Linux or Unix hacker or sysadmin. :)
PS. I do play a part time Linux sysadmin in real though...

---------------------------------------------------------------------------
|   "For to me to live is Christ, and to die is gain."                    |
|                                            --- Philippians 1:21 (KJV)   |
---------------------------------------------------------------------------
|   Ryan Kirkpatrick  |  Boulder, Colorado  |  http://www.rkirkpat.net/   |
---------------------------------------------------------------------------



> On Sun, 4 Feb 2001, Peter Eisentraut wrote:
> 
> > Ryan Kirkpatrick writes:
> > 
> > >     postgresql -> This is a Linux distribution independent (or so I
> > > hope) init.d/rc.d script that makes use of pg_ctl. There is currently a
> > > few in ./contrib/linux of the pgsql source tree, but they are RedHat
> > > specific. This one is simple and self contained. Might be worth adding to
> > > the other scripts.
> > 
> > I don't see how this can be more independent if it uses
> > 
> > DAEMON=/home/postgres/bin/pg_ctl
> 
>     Ooops.... That is my mistake... Should have been
> /usr/local/pgsql/bin/pg_ctl. I have /usr/local/pgsql/ symlinked to /home
> (where there is more, faster disk space). I can submit a patch, or can
> some one just fix it?

Change made.

> > LOG="/usr/local/pgsql/server.log"
> 
>     What is wrong with that? There really is no standard on where to
> put the log file, so it is either here or /var/log.
> 
> > su - postgres sh -c "$DAEMON stop >& /dev/null"
> 
>     Hmm... What is wrong here, besides the '>&'? The '>&' can be
> replaced with '2>&1 >' if that is more standard.
> 

Change made.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


Re: [PATCHES] A Sparc/Linux patch (for 7.1), and a Linux rc.d/init.d script....

From
Florent Guillaume
Date:
> > > su - postgres sh -c "$DAEMON stop >& /dev/null"
> > 
> >     Hmm... What is wrong here, besides the '>&'? The '>&' can be
> > replaced with '2>&1 >' if that is more standard.

It won't do what you want. You want '>/dev/null 2>&1'.

> Change made.

Hmmm, I don't see this change in cvsweb.


Florent

-- 
florent.guillaume@mail.com


> > > > su - postgres sh -c "$DAEMON stop >& /dev/null"
> > > 
> > >     Hmm... What is wrong here, besides the '>&'? The '>&' can be
> > > replaced with '2>&1 >' if that is more standard.
> 
> It won't do what you want. You want '>/dev/null 2>&1'.

Yes, I knew he wanted >/dev/null 2>&1.  I just fixed it.  

> 
> > Change made.
> 
> Hmmm, I don't see this change in cvsweb.

Thanks.  Seems I overwrote it with his new version.  Done now.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


Re: Re: [PATCHES] A Sparc/Linux patch (for 7.1), and a Linux rc.d/init.d script....

From
Ryan Kirkpatrick
Date:
On Tue, 6 Feb 2001, Bruce Momjian wrote:

> > > DAEMON=/home/postgres/bin/pg_ctl
> > 
> >     Ooops.... That is my mistake... Should have been
> > /usr/local/pgsql/bin/pg_ctl. I have /usr/local/pgsql/ symlinked to /home
> > (where there is more, faster disk space). I can submit a patch, or can
> > some one just fix it?
> 
> Change made.
Actually I found a few more places where I used /home/postgres
instead of /usr/local/pgsql. To make things clear (and for reasons
below) I have attached a new version of the file.

> > > su - postgres sh -c "$DAEMON stop >& /dev/null"
> > 
> >     Hmm... What is wrong here, besides the '>&'? The '>&' can be
> > replaced with '2>&1 >' if that is more standard.
> > 
> Change made.
Turns out that it has to be '> {dest} 2>&1' for it to work, at
least with bash. So, to reduce confusion on fixes to this file, as I
stated above, a new version is attached. It is tested to work and I don't
see any thing more that is non-standard. Though if you still see problems,
feel free to point them out. :) Thanks and TTYL.

---------------------------------------------------------------------------
|   "For to me to live is Christ, and to die is gain."                    |
|                                            --- Philippians 1:21 (KJV)   |
---------------------------------------------------------------------------
|   Ryan Kirkpatrick  |  Boulder, Colorado  |  http://www.rkirkpat.net/   |
---------------------------------------------------------------------------

Updated.

> On Tue, 6 Feb 2001, Bruce Momjian wrote:
> 
> > > > DAEMON=/home/postgres/bin/pg_ctl
> > > 
> > >     Ooops.... That is my mistake... Should have been
> > > /usr/local/pgsql/bin/pg_ctl. I have /usr/local/pgsql/ symlinked to /home
> > > (where there is more, faster disk space). I can submit a patch, or can
> > > some one just fix it?
> > 
> > Change made.
> 
>     Actually I found a few more places where I used /home/postgres
> instead of /usr/local/pgsql. To make things clear (and for reasons
> below) I have attached a new version of the file.
> 
> > > > su - postgres sh -c "$DAEMON stop >& /dev/null"
> > > 
> > >     Hmm... What is wrong here, besides the '>&'? The '>&' can be
> > > replaced with '2>&1 >' if that is more standard.
> > > 
> > Change made.
> 
>     Turns out that it has to be '> {dest} 2>&1' for it to work, at
> least with bash. So, to reduce confusion on fixes to this file, as I
> stated above, a new version is attached. It is tested to work and I don't
> see any thing more that is non-standard. Though if you still see problems,
> feel free to point them out. :) Thanks and TTYL.
> 
> ---------------------------------------------------------------------------
> |   "For to me to live is Christ, and to die is gain."                    |
> |                                            --- Philippians 1:21 (KJV)   |
> ---------------------------------------------------------------------------
> |   Ryan Kirkpatrick  |  Boulder, Colorado  |  http://www.rkirkpat.net/   |
> ---------------------------------------------------------------------------
Content-Description: 

[ Attachment, skipping... ]


--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


Applied.  Thanks.

> On Tue, 6 Feb 2001, Bruce Momjian wrote:
> 
> > > > DAEMON=/home/postgres/bin/pg_ctl
> > > 
> > >     Ooops.... That is my mistake... Should have been
> > > /usr/local/pgsql/bin/pg_ctl. I have /usr/local/pgsql/ symlinked to /home
> > > (where there is more, faster disk space). I can submit a patch, or can
> > > some one just fix it?
> > 
> > Change made.
> 
>     Actually I found a few more places where I used /home/postgres
> instead of /usr/local/pgsql. To make things clear (and for reasons
> below) I have attached a new version of the file.
> 
> > > > su - postgres sh -c "$DAEMON stop >& /dev/null"
> > > 
> > >     Hmm... What is wrong here, besides the '>&'? The '>&' can be
> > > replaced with '2>&1 >' if that is more standard.
> > > 
> > Change made.
> 
>     Turns out that it has to be '> {dest} 2>&1' for it to work, at
> least with bash. So, to reduce confusion on fixes to this file, as I
> stated above, a new version is attached. It is tested to work and I don't
> see any thing more that is non-standard. Though if you still see problems,
> feel free to point them out. :) Thanks and TTYL.
> 
> ---------------------------------------------------------------------------
> |   "For to me to live is Christ, and to die is gain."                    |
> |                                            --- Philippians 1:21 (KJV)   |
> ---------------------------------------------------------------------------
> |   Ryan Kirkpatrick  |  Boulder, Colorado  |  http://www.rkirkpat.net/   |
> ---------------------------------------------------------------------------
Content-Description: 

[ Attachment, skipping... ]


--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026