Skip site navigation (1) Skip section navigation (2)

Re: shuttting down postmaster

From: ChristophSchmidt <cs(dot)hilzingen(at)swol(dot)de>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: shuttting down postmaster
Date: 2000-07-05 13:58:30
Message-ID: 00070516004001.00613@nasen2 (view raw or flat)
Thread:
Lists: pgsql-novice
(another try to bring my answer to the mailing-list)


Try kill -TERM <pid> instead of  kill -HUP <pid> or  kill-9 <pid>
If you have a shellscript that starts postmaster then you may start and stop
the postmaster.
I have one from SuSE-Linux :
(may be you have to configure for your system) 
It is placed in /sbin/init.d/
Invoked during startup and shutdown
(You know the startup procedure in dependence of the runlevel ?)

[ how do you post to the mailinglist ?
I only get the postings but my answers don't appear ]
Christoph
#! /bin/sh
# Copyright (c) 1998 S.u.S.E. GmbH Fuerth, Germany.
#
# Author: 
#                Karl Eichwalder <ke(at)suse(dot)de>, 1998
#
# /sbin/init.d/postgres
#
#    and symbolic its link
#
# /sbin/rcpostgres
#

H=/usr/local/pgsql/bin/postmaster
# H=/sda4/usr/local/pgsql/bin/postmaster
 LOGFILE=/var/log/postgresql.log
DATADIR=/usr/local/pgsql/data
.. /etc/rc.config

# Determine the base and follow a runlevel link name.
base=${0##*/}
link=${base#*[SK][0-9][0-9]}

# Force execution if not called by a runlevel directory.
test $link = $base && START_POSTGRES=yes
test "$START_POSTGRES" = yes || exit 0

# The echo return value for success (defined in /etc/rc.config).
return=$rc_done
case "$1" in
      start)
 echo -n "Starting service postgres"
 ## Start daemon with startproc(8). If this fails
 ## the echo return value is set appropriate.

              su - postgres -c "/sbin/startproc -l $LOGFILE $H -i -o -F -D$DATADIR"\                        || return=$rc_failed
              echo -e "$return"
              ;;
      stop)
 echo -n "Shutting down service postgres"
 ## Stop daemon with killproc(8) and if this fails
 ## set echo the echo return value.

 killproc -TERM $H || return=$rc_failed

 echo -e "$return"
 ;;
      restart)
 ## If first returns OK call the second, if first or
 ## second command fails, set echo return value.
 $0 stop  &&  $0 start  ||  return=$rc_failed
 ;;
      reload)
 ## Choose ONE of the following two cases:

 ## First possibility: A few services accepts a signal
 ## to reread the (changed) configuration.

 #echo -n "Reload service postgres"
 #killproc -HUP /usr/sbin/postgres || return=$rc_failed
 #echo -e "$return"

 ## Exclusive possibility: Some services must be stopped
 ## and started to force a new load of the configuration.

 $0 stop  &&  $0 start  ||  return=$rc_failed
 ;;
      status)
 echo -n "Checking for service postgres: "
 ## Check status with checkproc(8), if process is running
 ## checkproc will return with exit status 0.

 checkproc $H && echo OK || echo No process
 ;;
#        probe)
#                ## Optional: Probe for the necessity of a reload,
#                ## give out the argument which is required for a reload.
# 
#                #test /etc/postgres.conf -nt /var/run/postgres.pid && echo reload
#                ;;
      *)
#        echo "Usage: $0 {start|stop|status|restart|reload[|probe]}"
 echo "Usage: $0 {start|stop|status|restart|reload}"
 exit 1
 ;;
esac

# Inform the caller not only verbosely and set an exit status.
test "$return" = "$rc_done" || exit 1
exit 0




Am Die, 04 Jul 2000 schrieben Sie:
> How can I shut down the postmaster? Everytime I reboot my pc I have
> problems to re-start it. There's always a file indicating that postgres is
> running, althoug it is not. This is created everytime I run postmaster. I
> must have a way to have postmaster deleting this file everytime it is shut
> down.
> 
> 	Paulo

In response to

pgsql-novice by date

Next:From: Thomas KrebsDate: 2000-07-05 18:26:27
Subject: newbie problem on creating table
Previous:From: ChristophSchmidtDate: 2000-07-05 10:39:40
Subject: Fwd: Re: shuttting down postmaster

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group