Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0b055d3

Browse files
author
Thomas G. Lockhart
committed
Linux-specific (RedHat variant) postgres system startup routine.
Initial version.
1 parentb072cd4 commit0b055d3

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

‎contrib/linux/postgres.init

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#! /bin/sh
2+
#
3+
# postgres.init Start postgres back end system.
4+
#
5+
# Author: Thomas Lockhart <Thomas.Lockhart@jpl.nasa.gov>
6+
# based on news startup by David Myers
7+
#
8+
# Written for RedHat Linux but should apply to other Linux distributions.
9+
# Assumptions:
10+
# - the postgres user is named "postgres"
11+
# - the postgres user is running csh/tcsh
12+
#
13+
14+
# Source function library.
15+
. /etc/rc.d/init.d/functions
16+
17+
# Get config.
18+
. /etc/sysconfig/network
19+
20+
# Check that networking is up.
21+
# Pretty much need it for postmaster.
22+
if [${NETWORKING}="no" ]
23+
then
24+
exit 0
25+
fi
26+
27+
[-f /opt/postgres/current/bin/postmaster ]||exit 0
28+
29+
# See how we were called.
30+
case"$1"in
31+
start)
32+
echo -n"Starting postgres service:"
33+
# force full login to get path names and environment variables
34+
# postgres runs tcsh so use proper syntax in redirection
35+
# change this line if another shell syntax is necessary
36+
#su - postgres -c 'postmaster -S' > /dev/null&
37+
su - postgres -c'postmaster >>&! /tmp/postmaster.log&'> /dev/null&
38+
sleep 5
39+
pid=`pidof postmaster`
40+
echo -n"postmaster [$pid]"
41+
#touch /var/lock/subsys/postmaster
42+
echo
43+
;;
44+
stop)
45+
echo -n"Stopping postgres service:"
46+
pid=`pidof postmaster`
47+
if ["$pid"!="" ];then
48+
echo -n"postmaster [$pid]"
49+
kill -TERM$pid
50+
sleep 1
51+
fi
52+
echo
53+
;;
54+
*)
55+
echo"Usage: postgres.init {start|stop}"
56+
exit 1
57+
esac
58+
59+
exit 0

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp