pg_ctl
+
+ pg_ctl
the status of a running postmaster. Although the postmaster can be
started manually,
pg_ctl encapulates
tasks such as redirecting log output, properly detaching from the
- terminal and process group, and additionally provides an option for
+ terminal and process group, and it provides convenient options for
controlled shut down.
- In mode, the postmaster that is running on
+ In mode, the postmaster that is running in
the specified data directory is shut down. Three different
shutdown methods can be selected with the
option: Smart
mode waits for all the clients to
not wait for clients to disconnect. All active transactions will
be rolled back. Immediate
mode will abort without
complete shutdown. This will lead to a recovery run on restart.
- By the default, stop mode waits for the shutdown to complete.
options.
+ mode simply sends the postmaster a SIGHUP signal,
+ causing it to reread its configuration files
+ (postgresql.conf, pg_hba.conf,
+ etc). This allows changing of configuration-file options that do not
+ require a complete restart to take effect.
+
+
mode checks whether a postmaster is running
and if so displays the
PID and the command line
-w
- Wait for the start or stutdown to complete. Times out after
+ Wait for the start or shutdown to complete. Times out after
60 seconds. This is the default for shutdowns.
#-------------------------------------------------------------------------
#
# pg_ctl.sh--
-# Start/Stop/Restart/Report status of postmaster
+# Start/Stop/Restart/HUP/Report status of postmaster
#
# Copyright (c) 2001 PostgreSQL Global Development Group
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/pg_ctl/Attic/pg_ctl.sh,v 1.23 2001/07/11 19:36:41 momjian Exp $
+# $Header: /cvsroot/pgsql/src/bin/pg_ctl/Attic/pg_ctl.sh,v 1.24 2001/09/21 21:10:56 tgl Exp $
#
#-------------------------------------------------------------------------
CMDNAME=`basename $0`
help="\
-$CMDNAME is a utility to start, stop, restart, and report the status
-of a PostgreSQL server.
+$CMDNAME is a utility to start, stop, restart, reload configuration files,
+or report the status of a PostgreSQL server.
Usage:
$CMDNAME start [-w] [-D DATADIR] [-s] [-l FILENAME] [-o \"OPTIONS\"]
$CMDNAME stop [-W] [-D DATADIR] [-s] [-m SHUTDOWN-MODE]
$CMDNAME restart [-w] [-D DATADIR] [-s] [-m SHUTDOWN-MODE] [-o \"OPTIONS\"]
+ $CMDNAME reload [-D DATADIR] [-s]
$CMDNAME status [-D DATADIR]
Common options:
restart)
op="restart"
;;
+ reload)
+ op="reload"
+ ;;
status)
op="status"
;;
;;
esac
+if [ "$op" = "reload" ];then
+ sig="-HUP"
+ wait=no
+fi
DEFPOSTOPTS=$PGDATA/postmaster.opts.default
POSTOPTSFILE=$PGDATA/postmaster.opts
fi
fi
-if [ "$op" = "stop" -o "$op" = "restart" ];then
+if [ "$op" = "stop" -o "$op" = "restart" -o "$op" = "reload" ];then
if [ -f $PIDFILE ];then
PID=`sed -n 1p $PIDFILE`
if [ $PID -lt 0 ];then
done
$silence_echo echo "done"
fi
- $silence_echo echo "postmaster successfully shut down"
+
+ if [ "$op" = "reload" ];then
+ $silence_echo echo "postmaster successfully signaled"
+ else
+ $silence_echo echo "postmaster successfully shut down"
+ fi
else # ! -f $PIDFILE
echo "$CMDNAME: cannot find $PIDFILE" 1>&2
exit 1
fi
fi
-fi # stop or restart
+fi # stop, restart, reload
if [ "$op" = "start" -o "$op" = "restart" ];then
oldpid=""