Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
c25b4dbf
Commit
c25b4dbf
authored
Nov 25, 2000
by
Peter Eisentraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update pg_ctl ref page, help output, messages. Some repair to work better
with current postmaster.
parent
f4710020
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
237 additions
and
273 deletions
+237
-273
doc/src/sgml/ref/pg_ctl-ref.sgml
doc/src/sgml/ref/pg_ctl-ref.sgml
+132
-213
src/bin/pg_ctl/Makefile
src/bin/pg_ctl/Makefile
+4
-2
src/bin/pg_ctl/pg_ctl.sh
src/bin/pg_ctl/pg_ctl.sh
+101
-58
No files found.
doc/src/sgml/ref/pg_ctl-ref.sgml
View file @
c25b4dbf
This diff is collapsed.
Click to expand it.
src/bin/pg_ctl/Makefile
View file @
c25b4dbf
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
#
#
# Copyright (c) 1999, PostgreSQL Global Development Group
# Copyright (c) 1999, PostgreSQL Global Development Group
#
#
# $Header: /cvsroot/pgsql/src/bin/pg_ctl/Makefile,v 1.
9 2000/09/17 13:02:35
petere Exp $
# $Header: /cvsroot/pgsql/src/bin/pg_ctl/Makefile,v 1.
10 2000/11/25 17:17:30
petere Exp $
#
#
#-------------------------------------------------------------------------
#-------------------------------------------------------------------------
...
@@ -15,7 +15,9 @@ include $(top_builddir)/src/Makefile.global
...
@@ -15,7 +15,9 @@ include $(top_builddir)/src/Makefile.global
all
:
pg_ctl
all
:
pg_ctl
pg_ctl
:
pg_ctl.sh
pg_ctl
:
pg_ctl.sh
cp
$<
$@
sed
-e
's/@VERSION@/
$(VERSION)
/g'
\
-e
's,@bindir@,
$(bindir)
,g'
\
$<
>
$@
chmod
a+x
$@
chmod
a+x
$@
install
:
all installdirs
install
:
all installdirs
...
...
src/bin/pg_ctl/pg_ctl.sh
View file @
c25b4dbf
...
@@ -8,14 +8,50 @@
...
@@ -8,14 +8,50 @@
#
#
#
#
# IDENTIFICATION
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/bin/pg_ctl/Attic/pg_ctl.sh,v 1.1
3 2000/10/24 19:11:15
petere Exp $
# $Header: /cvsroot/pgsql/src/bin/pg_ctl/Attic/pg_ctl.sh,v 1.1
4 2000/11/25 17:17:30
petere Exp $
#
#
#-------------------------------------------------------------------------
#-------------------------------------------------------------------------
CMDNAME
=
`
basename
$0
`
CMDNAME
=
`
basename
$0
`
help
=
"
\
$CMDNAME
is a utility to start, stop, restart, and report the status
of a PostgreSQL server.
Usage:
$CMDNAME
start [-w] [-D DATADIR] [-p PATH-TO-POSTMASTER] [-o
\"
OPTIONS
\"
]
$CMDNAME
stop [-w] [-D DATADIR] [-m SHUTDOWN-MODE]
$CMDNAME
restart [-w] [-D DATADIR] [-m SHUTDOWN-MODE] [-o
\"
OPTIONS
\"
]
$CMDNAME
status [-D DATADIR]
Options:
-D DATADIR Location of the database storage area
-m SHUTDOWN-MODE May be 'smart', 'fast', or 'immediate'
-o OPTIONS Command line options to pass to the postmaster
(PostgreSQL server executable)
-p PATH-TO-POSTMASTER Normally not necessary
-w Wait until operation completes
If the -D option is omitted, the environment variable PGDATA is used.
Shutdown modes are:
smart Quit after all clients have disconnected
fast Quit directly, with proper shutdown
immediate Quit without complete shutdown; will lead
to recovery run on restart
Report bugs to <pgsql-bugs@postgresql.org>."
advice
=
"
\
Try '
$CMDNAME
--help' for more information."
# Placed here during build
bindir
=
'@bindir@'
VERSION
=
'@VERSION@'
# Check for echo -n vs echo \c
# Check for echo -n vs echo \c
ECHO
=
echo
if
echo
'\c'
|
grep
-s
c
>
/dev/null 2>&1
if
echo
'\c'
|
grep
-s
c
>
/dev/null 2>&1
then
then
ECHO_N
=
"echo -n"
ECHO_N
=
"echo -n"
...
@@ -28,38 +64,35 @@ fi
...
@@ -28,38 +64,35 @@ fi
#
#
# Find out where we're located
# Find out where we're located
#
#
if
$ECHO
"
$0
"
|
grep
'/'
>
/dev/null 2>&1
if
echo
"
$0
"
|
grep
'/'
>
/dev/null 2>&1
then
then
# explicit dir name given
# explicit dir name given
PGPATH
=
`
$ECHO
$0
|
sed
's,/[^/]*$,,'
`
# (dirname command is not portable)
self_path
=
`
echo
$0
|
sed
's,/[^/]*$,,'
`
# (dirname command is not portable)
else
else
# look for it in PATH ('which' command is not portable)
# look for it in PATH ('which' command is not portable)
for
dir
in
`
$ECHO
"
$PATH
"
|
sed
's/:/ /g'
`
for
dir
in
`
echo
"
$PATH
"
|
sed
's/:/ /g'
`
do
do
# empty entry in path means current dir
# empty entry in path means current dir
[
-z
"
$dir
"
]
&&
dir
=
'.'
[
-z
"
$dir
"
]
&&
dir
=
'.'
if
[
-f
"
$dir
/
$CMDNAME
"
]
if
[
-f
"
$dir
/
$CMDNAME
"
]
then
then
PGPATH
=
"
$dir
"
self_path
=
"
$dir
"
break
break
fi
fi
done
done
fi
fi
# Check if needed programs actually exist in path
# Check if needed programs actually exist in path
for
prog
in
postmaster psql
if
[
-x
"
$self_path
/postmaster"
]
&&
[
-x
"
$self_path
/psql"
]
;
then
do
PGPATH
=
$self_path
if
[
!
-x
"
$PGPATH
/
$prog
"
]
elif
[
-x
"
$bindir
/postmaster"
]
&&
[
-x
"
$bindir
/psql"
]
;
then
then
PGPATH
=
$bindir
$ECHO
"The program
$prog
needed by
$CMDNAME
could not be found. It was"
else
$ECHO
"expected at:"
echo
"The programs 'postmaster' and 'psql' are needed by
$CMDNAME
but"
1>&2
$ECHO
"
$PGPATH
/
$prog
"
echo
"were not found in the directory '
$bindir
'."
1>&2
$ECHO
"If this is not the correct directory, please start
$CMDNAME
"
echo
"Check your installation."
1>&2
$ECHO
"with a full search path. Otherwise make sure that the program"
exit
1
$ECHO
"was installed successfully."
fi
exit
1
fi
done
po_path
=
$PGPATH
/postmaster
po_path
=
$PGPATH
/postmaster
...
@@ -69,14 +102,17 @@ sig="-TERM"
...
@@ -69,14 +102,17 @@ sig="-TERM"
while
[
"$#"
-gt
0
]
while
[
"$#"
-gt
0
]
do
do
case
$1
in
case
$1
in
-h
|
--help
)
-h
|
--help
|
-
\?
)
usage
=
1
echo
"
$help
"
break
exit
0
;;
;;
-V
|
--version
)
echo
"pg_ctl (PostgreSQL)
$VERSION
"
exit
0
;;
-D
)
-D
)
shift
shift
PGDATA
=
"
$1
"
PGDATA
=
"
$1
"
export
PGDATA
;;
;;
-p
)
-p
)
shift
shift
...
@@ -94,8 +130,9 @@ do
...
@@ -94,8 +130,9 @@ do
sig
=
"-QUIT"
sig
=
"-QUIT"
;;
;;
*
)
*
)
$ECHO
"
$CMDNAME
: Wrong shutdown mode
$sigopt
"
echo
"
$CMDNAME
: wrong shutdown mode:
$1
"
1>&2
usage
=
1
echo
"
$advice
"
1>&2
exit
1
;;
;;
esac
esac
;;
;;
...
@@ -106,6 +143,11 @@ do
...
@@ -106,6 +143,11 @@ do
shift
shift
POSTOPTS
=
"
$1
"
POSTOPTS
=
"
$1
"
;;
;;
-
*
)
echo
"
$CMDNAME
: invalid option:
$1
"
1>&2
echo
"
$advice
"
1>&2
exit
1
;;
start
)
start
)
op
=
"start"
op
=
"start"
;;
;;
...
@@ -119,23 +161,23 @@ do
...
@@ -119,23 +161,23 @@ do
op
=
"status"
op
=
"status"
;;
;;
*
)
*
)
usage
=
1
echo
"
$CMDNAME
: invalid operation mode:
$1
"
1>&2
break
echo
"
$advice
"
1>&2
exit
1
;;
;;
esac
esac
shift
shift
done
done
if
[
"
$usage
"
=
1
-o
"
$op
"
=
""
]
;
then
if
[
x
"
$op
"
=
x
""
]
;
then
$ECHO
"Usage:
$CMDNAME
[-w][-D database_dir][-p path_to_postmaster][-o
\"
postmaster_opts
\"
] start"
echo
"
$CMDNAME
: no operation mode specified"
1>&2
$ECHO
"
$CMDNAME
[-w][-D database_dir][-m s[mart]|f[ast]|i[mmediate]] stop"
echo
"
$advice
"
1>&2
$ECHO
"
$CMDNAME
[-w][-D database_dir][-m s[mart]|f[ast]|i[mmediate]][-o
\"
postmaster_opts
\"
] restart"
$ECHO
"
$CMDNAME
[-D database_dir] status"
exit
1
exit
1
fi
fi
if
[
-z
"
$PGDATA
"
]
;
then
if
[
-z
"
$PGDATA
"
]
;
then
$ECHO
"
$CMDNAME
: No database directory or environment variable
\$
PGDATA is specified"
echo
"
$CMDNAME
: no database directory or environment variable
\$
PGDATA is specified"
1>&2
echo
"
$advice
"
1>&2
exit
1
exit
1
fi
fi
...
@@ -148,15 +190,15 @@ if [ $op = "status" ];then
...
@@ -148,15 +190,15 @@ if [ $op = "status" ];then
PID
=
`
cat
$PIDFILE
`
PID
=
`
cat
$PIDFILE
`
if
[
$PID
-lt
0
]
;
then
if
[
$PID
-lt
0
]
;
then
PID
=
`
expr
0 -
$PID
`
PID
=
`
expr
0 -
$PID
`
$ECHO
"
$CMDNAME
: postgres is running (pid:
$PID
)"
echo
"
$CMDNAME
: postgres is running (pid:
$PID
)"
else
else
$ECHO
"
$CMDNAME
: postmaster is running (pid:
$PID
)"
echo
"
$CMDNAME
: postmaster is running (pid:
$PID
)"
$ECHO
"options are
:"
echo
"Command line was
:"
$ECHO
"
`
cat
$POSTOPTSFILE
`
"
echo
"
`
cat
$POSTOPTSFILE
`
"
fi
fi
exit
0
exit
0
else
else
$ECHO
"
$CMDNAME
: postmaster or postgres is not running"
echo
"
$CMDNAME
: postmaster or postgres is not running"
exit
1
exit
1
fi
fi
fi
fi
...
@@ -166,8 +208,8 @@ if [ $op = "stop" -o $op = "restart" ];then
...
@@ -166,8 +208,8 @@ if [ $op = "stop" -o $op = "restart" ];then
PID
=
`
cat
$PIDFILE
`
PID
=
`
cat
$PIDFILE
`
if
[
$PID
-lt
0
]
;
then
if
[
$PID
-lt
0
]
;
then
PID
=
`
expr
0 -
$PID
`
PID
=
`
expr
0 -
$PID
`
$ECHO
"
$CMDNAME
: Cannot restart postmaster. postgres is running (pid:
$PID
)"
echo
"
$CMDNAME
: Cannot restart postmaster. postgres is running (pid:
$PID
)"
$ECHO
"Please terminate postgres and try again"
echo
"Please terminate postgres and try again"
exit
1
exit
1
fi
fi
...
@@ -176,7 +218,7 @@ if [ $op = "stop" -o $op = "restart" ];then
...
@@ -176,7 +218,7 @@ if [ $op = "stop" -o $op = "restart" ];then
# wait for postmaster shutting down
# wait for postmaster shutting down
if
[
"
$wait
"
=
1
-o
$op
=
"restart"
]
;
then
if
[
"
$wait
"
=
1
-o
$op
=
"restart"
]
;
then
cnt
=
0
cnt
=
0
$ECHO_N
"Waiting for postmaster
shutting
down.."
$ECHO_C
$ECHO_N
"Waiting for postmaster
to shut
down.."
$ECHO_C
while
:
while
:
do
do
...
@@ -184,7 +226,7 @@ if [ $op = "stop" -o $op = "restart" ];then
...
@@ -184,7 +226,7 @@ if [ $op = "stop" -o $op = "restart" ];then
$ECHO_N
"."
$ECHO_C
$ECHO_N
"."
$ECHO_C
cnt
=
`
expr
$cnt
+ 1
`
cnt
=
`
expr
$cnt
+ 1
`
if
[
$cnt
-gt
60
]
;
then
if
[
$cnt
-gt
60
]
;
then
$ECHO
"
$CMDNAME
: postmaster does not shut down"
echo
"
$CMDNAME
: postmaster does not shut down"
exit
1
exit
1
fi
fi
else
else
...
@@ -192,16 +234,16 @@ if [ $op = "stop" -o $op = "restart" ];then
...
@@ -192,16 +234,16 @@ if [ $op = "stop" -o $op = "restart" ];then
fi
fi
sleep
1
sleep
1
done
done
$ECHO
"done.
"
echo
"done
"
fi
fi
$ECHO
"postmaster successfully shut down.
"
echo
"postmaster successfully shut down
"
else
else
$ECHO
"
$CMDNAME
: Can't find
$PIDFILE
.
"
echo
"
$CMDNAME
: cannot find
$PIDFILE
"
$ECHO
"Is postmaster running?"
echo
"Is postmaster running?"
if
[
$op
=
"restart"
]
;
then
if
[
$op
=
"restart"
]
;
then
$ECHO
"Anyway, I'm going to start up postmaster
..."
echo
"starting postmaster anyway
..."
else
else
exit
1
exit
1
fi
fi
...
@@ -210,7 +252,7 @@ fi
...
@@ -210,7 +252,7 @@ fi
if
[
$op
=
"start"
-o
$op
=
"restart"
]
;
then
if
[
$op
=
"start"
-o
$op
=
"restart"
]
;
then
if
[
-f
$PIDFILE
]
;
then
if
[
-f
$PIDFILE
]
;
then
$ECHO
"
$CMDNAME
: It seems another postmaster is running. Try
to start postmaster anyway."
echo
"
$CMDNAME
: It seems another postmaster is running. Trying
to start postmaster anyway."
pid
=
`
cat
$PIDFILE
`
pid
=
`
cat
$PIDFILE
`
fi
fi
...
@@ -219,21 +261,22 @@ if [ $op = "start" -o $op = "restart" ];then
...
@@ -219,21 +261,22 @@ if [ $op = "start" -o $op = "restart" ];then
if
[
$op
=
"start"
]
;
then
if
[
$op
=
"start"
]
;
then
# if we are in start mode, then look for postmaster.opts.default
# if we are in start mode, then look for postmaster.opts.default
if
[
-f
$DEFPOSTOPTS
]
;
then
if
[
-f
$DEFPOSTOPTS
]
;
then
eval
"
$po_path
`
cat
$DEFPOSTOPTS
`
"
&
$po_path
-D
$PGDATA
`
cat
$DEFPOSTOPTS
`
&
else
else
$po_path
&
$po_path
-D
$PGDATA
&
fi
fi
else
else
# if we are in restart mode, then look postmaster.opts
# if we are in restart mode, then look postmaster.opts
eval
`
cat
$POSTOPTSFILE
`
&
`
cat
$POSTOPTSFILE
`
&
fi
fi
else
else
eval
"
$po_path
$POSTOPTS
"
&
# -o given
$po_path
-D
$PGDATA
$POSTOPTS
&
fi
fi
if
[
-f
$PIDFILE
]
;
then
if
[
-f
$PIDFILE
]
;
then
if
[
"
`
cat
$PIDFILE
`
"
=
"
$pid
"
]
;
then
if
[
"
`
cat
$PIDFILE
`
"
=
"
$pid
"
]
;
then
$ECHO
"
$CMDNAME
: Cannot start postmaster. Is another postmaster is running?"
echo
"
$CMDNAME
: Cannot start postmaster. Is another postmaster is running?"
exit
1
exit
1
fi
fi
fi
fi
...
@@ -241,7 +284,7 @@ if [ $op = "start" -o $op = "restart" ];then
...
@@ -241,7 +284,7 @@ if [ $op = "start" -o $op = "restart" ];then
# wait for postmaster starting up
# wait for postmaster starting up
if
[
"
$wait
"
=
1
]
;
then
if
[
"
$wait
"
=
1
]
;
then
cnt
=
0
cnt
=
0
$ECHO_N
"Waiting for postmaster
starting
up.."
$ECHO_C
$ECHO_N
"Waiting for postmaster
to start
up.."
$ECHO_C
while
:
while
:
do
do
if
psql
-l
>
/dev/null 2>&1
if
psql
-l
>
/dev/null 2>&1
...
@@ -251,16 +294,16 @@ if [ $op = "start" -o $op = "restart" ];then
...
@@ -251,16 +294,16 @@ if [ $op = "start" -o $op = "restart" ];then
$ECHO_N
"."
$ECHO_C
$ECHO_N
"."
$ECHO_C
cnt
=
`
expr
$cnt
+ 1
`
cnt
=
`
expr
$cnt
+ 1
`
if
[
$cnt
-gt
60
]
;
then
if
[
$cnt
-gt
60
]
;
then
$ECHO
"
$CMDNAME
: postmaster does not start up"
echo
"
$CMDNAME
: postmaster does not start up"
exit
1
exit
1
fi
fi
sleep
1
sleep
1
fi
fi
done
done
$ECHO
"done.
"
echo
"done
"
fi
fi
$ECHO
"postmaster successfully started up.
"
echo
"postmaster successfully started up
"
fi
fi
exit
0
exit
0
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment