88# This version can log backend output through syslog using the local5 facility.
99# To enable this, edit /etc/syslog.conf to include a line similar to:
1010# local5.* /var/log/postgres
11- # and then set USE_SYSLOG to "yes" below
11+ # and then set USE_SYSLOG to "yes"and FACILITY to "local5" below
1212#
13- # PGBIN="/opt/postgres/current/bin"# not used
13+ # PGBIN="/opt/postgres/current/bin"# not used any more - thomas 1997-12-14
1414PGACCOUNT=" postgres" # the postgres account (you called it something else?)
1515POSTMASTER=" postmaster" # this probably won't change
1616
17+ USE_SOCKET=" yes" # "no" to disable Unix sockets on localhost
18+ PGSOCKETFILE=" /tmp/.s.PGSQL.5432"
1719USE_SYSLOG=" yes" # "yes" to enable syslog, "no" to go to /tmp/postgres.log
1820FACILITY=" local5" # can assign local0-local7 as the facility for logging
1921PGLOGFILE=" /tmp/postgres.log" # only used if syslog is disabled
2022
21- PGOPTS=" -B 256"
22- # PGOPTS="-i -B 256"# -i to enable TCP/IP rather than Unix socket
23+ PGOPTS=" -i -B 1024" # -S -o '-Fe'"
24+ if [${USE_SOCKET} = " no" ]
25+ then
26+ PGOPTS=" -i${PGOPTS} " # -i to enable TCP/IP rather than Unix socket
27+ fi
2328
2429# Source function library.
2530. /etc/rc.d/init.d/functions
3439exit 0
3540fi
3641
42+ # Don't bother checking for file existance to avoid hardcoding any paths - thomas 1997-12-14
3743# [ -f ${PGBIN}/${POSTMASTER} ] || exit 0
3844
3945# See how we were called.
4046case " $1 " in
4147 start)
48+ # force a stop to kill a running postmaster and to clean up sockets
49+ # necessary if system crashed (a power outage provoked this feature)
50+ eval $0 stop
51+ # save the old log file, if any
4252if [-f ${PGLOGFILE} ]
4353then
4454mv${PGLOGFILE} ${PGLOGFILE} .old
4555fi
56+
4657echo -n" Starting postgres:"
58+
4759# force full login to get path names
48- # my postgres runsSH/BASH so use proper syntax in redirection...
60+ # my postgres runstcsh so use proper syntax in redirection...
4961if [${USE_SYSLOG} = " yes" ]; then
50- su -${PGACCOUNT} -c" (${POSTMASTER} ${PGOPTS} 2>&1 | logger -p${FACILITY} .notice) &" > /dev/null2>&1 &
62+ su -${PGACCOUNT} -c" (${POSTMASTER} ${PGOPTS} |& logger -p${FACILITY} .notice) &" > /dev/null&
5163else
52- su -${PGACCOUNT} -c" ${POSTMASTER} ${PGOPTS} 2 >>&1 ${PGLOGFILE} &" > /dev/null2>&1 &
64+ su -${PGACCOUNT} -c" ${POSTMASTER} ${PGOPTS} >>&! ${PGLOGFILE} &" > /dev/null&
5365fi
5466sleep 5
5567pid=` pidof${POSTMASTER} `
@@ -65,6 +77,10 @@ case "$1" in
6577kill -TERM$pid
6678sleep 1
6779fi
80+ if [${USE_SOCKET} = " yes" ]&& [-S ${PGSOCKETFILE} ]; then
81+ echo -n" (remove socket${PGSOCKETFILE} )"
82+ rm -f${PGSOCKETFILE}
83+ fi
6884echo
6985;;
7086* )