Thread: Improvement Linux startup script

Improvement Linux startup script

From
Rene Pijlman
Date:
Hello,

The linux startup script contrib/start-scripts/linux in PostgreSQL
7.1.2 can be made easier to install by adding a few comment lines:

diff /usr/local/src/postgresql-7.1.2/contrib/start-scripts/linux
/etc/init.d/postgresql
2a3,5
> # chkconfig: 2345 98 02
> # description: PostgreSQL RDBMS
>
15c18,19
< # Or check out the chkconfig program, if you have it.
---
> # Or, if you have chkconfig, simply:
> # chkconfig --add postgresql

Tested on Red Hat Linux 7.1 with PostgreSQL 7.1.2.

Relevant part of the chkconfig man page:

:RUNLEVEL FILES
:       Each service which should be manageable by chkconfig needs
:       two or more commented lines added to  its  init.d  script.
:       The  first line tells chkconfig what runlevels the service
:       should be started in by default, as well as the start  and
:       stop  priority  levels.  If  the  service  should  not, by
:       default, be started in any runlevels, a - should  be  used
:       in  place of the runlevels list.  The second line contains
:       a description for the service, and may be extended  across
:       multiple lines with backslash continuation.
:
:       For example, random.init has these three lines:
:       # chkconfig: 2345 20 80
:       # description: Saves and restores system entropy pool for \
:       #              higher quality random number generation.
:       This says that the random script should be started in lev­
:       els 2, 3, 4, and 5, that its start priority should be  20,
:       and  that  its  stop priority should be 80.  You should be
:       able to figure out what the description says; the \ causes
:       the line to be continued.  The extra space in front of the
:       line is ignored.

Regards,
René Pijlman

Re: Improvement Linux startup script

From
Bruce Momjian
Date:
I will need a diff -c, context diff, to apply this.

> Hello,
>
> The linux startup script contrib/start-scripts/linux in PostgreSQL
> 7.1.2 can be made easier to install by adding a few comment lines:
>
> diff /usr/local/src/postgresql-7.1.2/contrib/start-scripts/linux
> /etc/init.d/postgresql
> 2a3,5
> > # chkconfig: 2345 98 02
> > # description: PostgreSQL RDBMS
> >
> 15c18,19
> < # Or check out the chkconfig program, if you have it.
> ---
> > # Or, if you have chkconfig, simply:
> > # chkconfig --add postgresql
>
> Tested on Red Hat Linux 7.1 with PostgreSQL 7.1.2.
>
> Relevant part of the chkconfig man page:
>
> :RUNLEVEL FILES
> :       Each service which should be manageable by chkconfig needs
> :       two or more commented lines added to  its  init.d  script.
> :       The  first line tells chkconfig what runlevels the service
> :       should be started in by default, as well as the start  and
> :       stop  priority  levels.  If  the  service  should  not, by
> :       default, be started in any runlevels, a - should  be  used
> :       in  place of the runlevels list.  The second line contains
> :       a description for the service, and may be extended  across
> :       multiple lines with backslash continuation.
> :
> :       For example, random.init has these three lines:
> :       # chkconfig: 2345 20 80
> :       # description: Saves and restores system entropy pool for \
> :       #              higher quality random number generation.
> :       This says that the random script should be started in lev?
> :       els 2, 3, 4, and 5, that its start priority should be  20,
> :       and  that  its  stop priority should be 80.  You should be
> :       able to figure out what the description says; the \ causes
> :       the line to be continued.  The extra space in front of the
> :       line is ignored.
>
> Regards,
> Ren? Pijlman
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>

--
  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, Pennsylvania 19026

Re: Improvement Linux startup script

From
Bruce Momjian
Date:
Your patch has been added to the PostgreSQL unapplied patches list at:

    http://candle.pha.pa.us/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

> Hello Bruce,
>
> You wrote:
> >I will need a diff -c, context diff, to apply this.
>
> Sorry, I wasn't aware of that. Here it is.
>
> Regards,
> Ren? Pijlman
>
> %diff -c /usr/local/src/postgresql-7.1.2/contrib/start-scripts/linux /etc/init.d/postgresql
>
> *** /usr/local/src/postgresql-7.1.2/contrib/start-scripts/linux    Sat Jul 21 17:17:14 2001
> --- /etc/init.d/postgresql    Sat Jul 21 17:17:59 2001
> ***************
> *** 1,5 ****
> --- 1,8 ----
>   #! /bin/sh
>
> + # chkconfig: 2345 98 02
> + # description: PostgreSQL RDBMS
> +
>   # This is an example of a start/stop script for SysV-style init, such
>   # as is used on Linux systems.  You should edit some of the variables
>   # and maybe the 'echo' commands.
> ***************
> *** 12,18 ****
>   #   /etc/rc.d/rc3.d/S98postgresql
>   #   /etc/rc.d/rc4.d/S98postgresql
>   #   /etc/rc.d/rc5.d/S98postgresql
> ! # Or check out the chkconfig program, if you have it.
>   #
>   # Proper init scripts on Linux systems normally require setting lock
>   # and pid files under /var/run as well as reacting to network
> --- 15,22 ----
>   #   /etc/rc.d/rc3.d/S98postgresql
>   #   /etc/rc.d/rc4.d/S98postgresql
>   #   /etc/rc.d/rc5.d/S98postgresql
> ! # Or, if you have chkconfig, simply:
> ! # chkconfig --add postgresql
>   #
>   # Proper init scripts on Linux systems normally require setting lock
>   # and pid files under /var/run as well as reacting to network
>

--
  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, Pennsylvania 19026

Re: Improvement Linux startup script

From
Bruce Momjian
Date:
Patch applied.  Thanks.

> Hello Bruce,
>
> You wrote:
> >I will need a diff -c, context diff, to apply this.
>
> Sorry, I wasn't aware of that. Here it is.
>
> Regards,
> Ren? Pijlman
>
> %diff -c /usr/local/src/postgresql-7.1.2/contrib/start-scripts/linux /etc/init.d/postgresql
>
> *** /usr/local/src/postgresql-7.1.2/contrib/start-scripts/linux    Sat Jul 21 17:17:14 2001
> --- /etc/init.d/postgresql    Sat Jul 21 17:17:59 2001
> ***************
> *** 1,5 ****
> --- 1,8 ----
>   #! /bin/sh
>
> + # chkconfig: 2345 98 02
> + # description: PostgreSQL RDBMS
> +
>   # This is an example of a start/stop script for SysV-style init, such
>   # as is used on Linux systems.  You should edit some of the variables
>   # and maybe the 'echo' commands.
> ***************
> *** 12,18 ****
>   #   /etc/rc.d/rc3.d/S98postgresql
>   #   /etc/rc.d/rc4.d/S98postgresql
>   #   /etc/rc.d/rc5.d/S98postgresql
> ! # Or check out the chkconfig program, if you have it.
>   #
>   # Proper init scripts on Linux systems normally require setting lock
>   # and pid files under /var/run as well as reacting to network
> --- 15,22 ----
>   #   /etc/rc.d/rc3.d/S98postgresql
>   #   /etc/rc.d/rc4.d/S98postgresql
>   #   /etc/rc.d/rc5.d/S98postgresql
> ! # Or, if you have chkconfig, simply:
> ! # chkconfig --add postgresql
>   #
>   # Proper init scripts on Linux systems normally require setting lock
>   # and pid files under /var/run as well as reacting to network
>

--
  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, Pennsylvania 19026