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
5b912b08
Commit
5b912b08
authored
Dec 06, 1999
by
Tatsuo Ishii
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pg_ctl: a script to start/stop/restart and report status of postmaster.
parent
169051af
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
219 additions
and
0 deletions
+219
-0
src/bin/pg_ctl/Makefile
src/bin/pg_ctl/Makefile
+28
-0
src/bin/pg_ctl/pg_ctl.sh
src/bin/pg_ctl/pg_ctl.sh
+191
-0
No files found.
src/bin/pg_ctl/Makefile
0 → 100644
View file @
5b912b08
#-------------------------------------------------------------------------
#
# Makefile.inc--
# Makefile for bin/pg_ctl
#
# Copyright (c) 1999, PostgreSQL Global Development Group
#
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/bin/pg_ctl/Makefile,v 1.1 1999/12/06 07:23:41 ishii Exp $
#
#-------------------------------------------------------------------------
SRCDIR
=
../..
include
../../Makefile.global
all
:
pg_ctl
pg_ctl
:
pg_ctl.sh
sed
-e
's@__BINDIR__@
$(BINDIR)
@'
pg_ctl.sh
>
pg_ctl
install
:
pg_ctl
$(INSTALL)
$(INSTL_EXE_OPTS)
$<
$(BINDIR)
/
$<
clean
:
rm
-f
pg_ctl
dep depend
:
src/bin/pg_ctl/pg_ctl.sh
0 → 100755
View file @
5b912b08
#! /bin/sh
#-------------------------------------------------------------------------
#
# pg_ctl.sh--
# Start/Stop/Restart/Report status of postmaster
#
# Copyright (c) 1999, PostgreSQL Global Development Group
#
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/bin/pg_ctl/Attic/pg_ctl.sh,v 1.1 1999/12/06 07:23:41 ishii Exp $
#
#-------------------------------------------------------------------------
CMDNAME
=
`
basename
$0
`
# set default path to postmaster
po_path
=
__BINDIR__/postmaster
# set default shutdown signal
sig
=
"-TERM"
while
[
"$#"
-gt
0
]
do
case
$1
in
-h
|
--help
)
usage
=
1
break
;;
-D
)
shift
PGDATA
=
"
$1
"
;;
-p
)
shift
po_path
=
"
$1
"
;;
-m
)
shift
case
$1
in
f|fast
)
sig
=
"-INT"
;;
i|immediate
)
sig
=
"-QUIT"
;;
*
)
echo
"
$CMDNAME
: Wrong shutdown mode
$sigopt
"
usage
=
1
;;
esac
;;
-w
)
wait
=
1
;;
-o
)
shift
POSTOPTS
=
"
$1
"
;;
start
)
op
=
"start"
;;
stop
)
op
=
"stop"
;;
restart
)
op
=
"restart"
;;
status
)
op
=
"status"
;;
*
)
usage
=
1
break
;;
esac
shift
done
if
[
"
$usage
"
=
1
-o
"
$op
"
=
""
]
;
then
echo
"Usage:
$CMDNAME
[-w][-D database_dir][-p path_to_postmaster][-o
\"
postmaster_opts
\"
] start"
echo
"
$CMDNAME
[-w][-D database_dir][-m s[mart]|f[ast]|i[mmediate]] stop"
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
fi
if
[
-z
"
$PGDATA
"
]
;
then
echo
"
$CMDNAME
: No database directory or environment variable
\$
PGDATA is specified"
exit
1
fi
DEFPOSTOPTS
=
$PGDATA
/postmaster.opts.default
POSTOPTSFILE
=
$PGDATA
/postmaster.opts
PIDFILE
=
$PGDATA
/postmaster.pid
if
[
$op
=
"status"
]
;
then
if
[
-f
$PIDFILE
]
;
then
echo
"
$CMDNAME
: postmaster is running (pid:
`
cat
$PIDFILE
`
)"
echo
"options are:"
echo
"
`
cat
$POSTOPTSFILE
`
"
exit
0
else
echo
"
$CMDNAME
: postmaster is not running"
exit
1
fi
fi
if
[
$op
=
"stop"
-o
$op
=
"restart"
]
;
then
if
[
-f
$PIDFILE
]
;
then
kill
$sig
`
cat
$PIDFILE
`
# wait for postmaster shutting down
if
[
"
$wait
"
=
1
-o
$op
=
"restart"
]
;
then
cnt
=
0
echo
-n
"Waiting for postmaster shutting down.."
while
:
do
if
[
-f
$PIDFILE
]
;
then
echo
-n
"."
cnt
=
`
expr
$cnt
+ 1
`
if
[
$cnt
-gt
60
]
;
then
echo
"
$CMDNAME
: postmaster does not shut down"
exit
1
fi
else
break
fi
sleep
1
done
echo
"done."
fi
else
echo
"
$CMDNAME
: Can't find
$PIDFILE
."
echo
"Is postmaster running?"
if
[
$op
=
"restart"
]
;
then
echo
"Anyway, I'm going to start up postmaster..."
else
exit
1
fi
fi
fi
if
[
$op
=
"start"
-o
$op
=
"restart"
]
;
then
if
[
-f
$PIDFILE
]
;
then
echo
"
$CMDNAME
: It seems another postmaster is running. Try to start postmaster anyway."
pid
=
`
cat
$PIDFILE
`
fi
if
[
-z
"
$POSTOPTS
"
]
;
then
if
[
-f
$DEFPOSTOPTS
]
;
then
eval
`
cat
$DEFPOSTOPTS
`
&
else
echo
"
$CMDNAME
: Can't find
$DEFPOSTOPTS
"
exit
1
fi
else
$po_path
$POSTOPTS
&
fi
if
[
-f
$PIDFILE
]
;
then
if
[
"
`
cat
$PIDFILE
`
"
=
"
$pid
"
]
;
then
echo
"
$CMDNAME
: Cannot start postmaster. Is another postmaster is running?"
exit
1
fi
fi
# wait for postmaster starting up
if
[
"
$wait
"
=
1
]
;
then
cnt
=
0
echo
-n
"Waiting for postmaster starting up.."
while
:
do
if
[
!
-f
$PIDFILE
]
;
then
echo
-n
"."
cnt
=
`
expr
$cnt
+ 1
`
if
[
$cnt
-gt
60
]
;
then
echo
"
$CMDNAME
: postmaster does not start up"
exit
1
fi
sleep
1
else
break
fi
done
echo
"done."
fi
fi
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