diff options
author | Bruce Momjian <bruce@momjian.us> | 1998-04-27 03:07:18 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 1998-04-27 03:07:18 +0000 |
commit | f34b9bbac81f69862af55974dc0ff725bcae95d3 (patch) | |
tree | 9f987a9e335d0c059f8a71287604fad42ef1f46e /contrib/linux/postgres.init | |
parent | 4fcd0d63717d5afc4991cd59d0a517e241cfa961 (diff) | |
download | postgresql-f34b9bbac81f69862af55974dc0ff725bcae95d3.tar.gz postgresql-f34b9bbac81f69862af55974dc0ff725bcae95d3.zip |
Improved version from Claudiu
Diffstat (limited to 'contrib/linux/postgres.init')
-rwxr-xr-x | contrib/linux/postgres.init | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/contrib/linux/postgres.init b/contrib/linux/postgres.init index b8857796962..b47d7a8482f 100755 --- a/contrib/linux/postgres.init +++ b/contrib/linux/postgres.init @@ -11,6 +11,7 @@ # and then set USE_SYSLOG to "yes" below # #PGBIN="/opt/postgres/current/bin" # not used + PGACCOUNT="postgres" # the postgres account (you called it something else?) POSTMASTER="postmaster" # this probably won't change @@ -18,8 +19,7 @@ USE_SYSLOG="yes" # "yes" to enable syslog, "no" to go to /tmp/postgres.log FACILITY="local5" # can assign local0-local7 as the facility for logging PGLOGFILE="/tmp/postgres.log" # only used if syslog is disabled -PGOPTS="-B 256" -#PGOPTS="-i -B 256" # -i to enable TCP/IP rather than Unix socket +PGOPTS="-i -B 2048" # Source function library. . /etc/rc.d/init.d/functions @@ -39,31 +39,33 @@ fi # See how we were called. case "$1" in start) - if [ -f ${PGLOGFILE} ] + if [ -f ${PGLOGFILE} ] then mv ${PGLOGFILE} ${PGLOGFILE}.old fi echo -n "Starting postgres: " # force full login to get path names -# my postgres runs tcsh so use proper syntax in redirection... if [ ${USE_SYSLOG} = "yes" ]; then - su - ${PGACCOUNT} -c "(${POSTMASTER} ${PGOPTS} |& logger -p ${FACILITY}.notice) &" > /dev/null& + su - ${PGACCOUNT} -c "(${POSTMASTER} ${PGOPTS} 2>&1 | logger -p ${FACILITY}.notice) &" > /dev/null 2>&1 & else - su - ${PGACCOUNT} -c "${POSTMASTER} ${PGOPTS} >>&! ${PGLOGFILE} &" > /dev/null& + su - ${PGACCOUNT} -c "${POSTMASTER} ${PGOPTS} 2>>&1 ${PGLOGFILE} &" > /dev/null 2>&1 & fi sleep 5 pid=`pidof ${POSTMASTER}` echo -n "${POSTMASTER} [$pid]" + sleep 2 # touch /var/lock/subsys/${POSTMASTER} +# use the name of the symlink + touch /var/lock/subsys/postgres echo ;; stop) - echo -n "Stopping postgres: " + echo -n "Stopping postgres: " pid=`pidof ${POSTMASTER}` if [ "$pid" != "" ] ; then echo -n "${POSTMASTER} [$pid]" kill -TERM $pid - sleep 1 + sleep 3 fi echo ;; |