Eliminating start error message: "unary operator expected"
Hi Forum,
What should I correct in order to eliminate the following error message on
start:
Executing /etc/rc.d/init.d/postgresql start ..
Starting postgresql service: -sh: [: ==: unary operator expected
[ OK ]
We installed a v7.3.2 and PostgreSQL seems to be running very well but we
want to get rid of this message.
Thanks in advance for your response
On Mon, 23 Jun 2003, Carlos wrote:
Hi Forum,
What should I correct in order to eliminate the following error message on
start:
Executing /etc/rc.d/init.d/postgresql start ..
Starting postgresql service: -sh: [: ==: unary operator expected
[ OK ]We installed a v7.3.2 and PostgreSQL seems to be running very well but we
want to get rid of this message.
How did you install postgresql (rpms, source code) and where did the
startup script come from?
On 23/06/2003 20:16 Carlos wrote:
Hi Forum,
What should I correct in order to eliminate the following error message
on
start:
Executing /etc/rc.d/init.d/postgresql start ..
Starting postgresql service: -sh: [: ==: unary operator expected
[ OK ]We installed a v7.3.2 and PostgreSQL seems to be running very well but we
want to get rid of this message.Thanks in advance for your response
You may have a typo in /etc/rc.d/init.d/postgresql.
--
Paul Thomas
+------------------------------+---------------------------------------------+
| Thomas Micro Systems Limited | Software Solutions for the Smaller
Business |
| Computer Consultants |
http://www.thomas-micro-systems-ltd.co.uk |
+------------------------------+---------------------------------------------+
Postgresql was installed from RPMS, downloaded from the following url:
ftp://ftp5.us.postgresql.org/pub/PostgreSQL/binary/v7.3.2/RPMS/redhat-7.
3/
The startup script was created when the rpms were installed.
-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org] On Behalf Of scott.marlowe
Sent: Monday, June 23, 2003 3:35 PM
To: Carlos
Cc: 'pgsql-general@postgresql.org'
Subject: Re: [GENERAL] Eliminating start error message: "unary operator
On Mon, 23 Jun 2003, Carlos wrote:
Hi Forum,
What should I correct in order to eliminate the following error
message on
start:
Executing /etc/rc.d/init.d/postgresql start ..
Starting postgresql service: -sh: [: ==: unary operator expected
[ OK ]We installed a v7.3.2 and PostgreSQL seems to be running very well but
we want to get rid of this message.
How did you install postgresql (rpms, source code) and where did the
startup script come from?
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?
Import Notes
Reply to msg id not found: E148BE531B8AD311922E005004D3EEA101E56684@xchserver.pbsinet.com | Resolved by subject fallback
On Mon, 23 Jun 2003, Carlos wrote:
Hi Forum,
What should I correct in order to eliminate the following error message on
start:
Executing /etc/rc.d/init.d/postgresql start ..
Starting postgresql service: -sh: [: ==: unary operator expected
[ OK ]We installed a v7.3.2 and PostgreSQL seems to be running very well but we
want to get rid of this message.Thanks in advance for your response
You should ask your system admin to take a look. That init script should be
pretty straight forward unless your admin has rolled his/her own complicated
thing.
--
Nigel J. Andrews
Could you post a copy of the /etc/rc.d/init.d/postgresql file here? It
may have gotten corrupted or have a simple syntax error in it.
On Mon, 23 Jun 2003, Carlos Oliva wrote:
Show quoted text
Postgresql was installed from RPMS, downloaded from the following url:
ftp://ftp5.us.postgresql.org/pub/PostgreSQL/binary/v7.3.2/RPMS/redhat-7.
3/
The startup script was created when the rpms were installed.-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org] On Behalf Of scott.marlowe
Sent: Monday, June 23, 2003 3:35 PM
To: Carlos
Cc: 'pgsql-general@postgresql.org'
Subject: Re: [GENERAL] Eliminating start error message: "unary operatorOn Mon, 23 Jun 2003, Carlos wrote:
Hi Forum,
What should I correct in order to eliminate the following error
message on
start:
Executing /etc/rc.d/init.d/postgresql start ..
Starting postgresql service: -sh: [: ==: unary operator expected
[ OK ]We installed a v7.3.2 and PostgreSQL seems to be running very well but
we want to get rid of this message.
How did you install postgresql (rpms, source code) and where did the
startup script come from?---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?http://www.postgresql.org/docs/faqs/FAQ.html
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
Hi Scott,
There it goes. I also enclosed it in a text file.
Thanks you for your help
#! /bin/sh
# postgresql This is the init script for starting up the PostgreSQL
# server
#
# chkconfig: - 85 15
# description: Starts and stops the PostgreSQL backend daemon that
handles \
# all database requests.
# processname: postmaster
# pidfile: /var/run/postmaster.pid
# Version 6.5.3-2 Lamar Owen
# Added code to determine if PGDATA exists, whether it is current
version
# or not, and initdb if no PGDATA (initdb will not overwrite a
database).
# Version 7.0 Lamar Owen
# Added logging code
# Changed PGDATA.
#
# Version 7.0.2 Trond Eivind Glomsrd <teg@redhat.com>
# use functions, add conditional restart
# Version 7.0.3 Lamar Owen <lamar@postgresql.org>
# Check for the existence of functions before blindly using them
# in particular -- check for success () and failure () before using.
# More Cross-distribution support -- PGVERSION variable, and docdir
checks.
# Version 7.1 Release Candidate Lamar Owen <lamar@postgresql.org>
# initdb parameters have changed.
# Version 7.1.2 Trond Eivind Glomsrd <teg@redhat.com>
# Specify shell for su
# Handle stop better - kill unwanted output, make it wait until the
database is ready
# Handle locales slightly differently - always using "C" isn't a valid
option
# Kill output from database initialization
# Mark messages for translation
# Version 7.1.2-2.PGDG Lamar Owen <lamar.owen@wgcr.org>
# sync up.
# Karl's fixes for some quoting issues.
# Version 7.2b2 Lamar Owen <lamar.owen@wgcr.org>
# version change.
# Version 7.2 final. Lamar Owen <lamar.owen@wgcr.org>
# reload from Peter E.
# Eliminate the pidof postmaster test in stop -- we're using pg_ctl so
we don't need pidof.
# Tested the $? return for the stop script -- it does in fact propagate.
# TODO: multiple postmasters.
# VErsion 7.3 Lamar OWen <lamar.owen@ramifordistat.net>
# Multiple postmasters, courtesy Karl DeBisschop
# PGVERSION is:
PGVERSION=7.3
# Source function library.
INITD=/etc/rc.d/init.d
. $INITD/functions
# Get function listing for cross-distribution logic.
TYPESET=`typeset -F`
# Get config.
. /etc/sysconfig/network
# Find the name of the script
NAME=`basename $0`
# Set defaults for port and database directory
PGPORT=5432
export PGDATA=/var/lib/pgsql
if [ -f $PGDATA/PG_VERSION ] && [ -d $PGDATA/base/template1 ]
then
echo "Using old-style directory structure"
else
export PGDATA=/var/lib/pgsql/data
fi
# Override defaults from /etc/sysconfig/pgsql if file is present
[ -f /etc/sysconfig/pgsql/${NAME} ] && . /etc/sysconfig/pgsql/${NAME}
export PGDATA
export PGPORT
export PGOPTS
# Check that networking is up.
# Pretty much need it for postmaster.
[ "${NETWORKING}" = "no" ] && exit 0
[ -f /usr/bin/postmaster ] || exit 0
start(){
PSQL_START=$"Starting ${NAME} service: "
# Check for the PGDATA structure
if [ -f $PGDATA/PG_VERSION ] && [ -d $PGDATA/base ]
then
# Check version of existing PGDATA
if [ `cat $PGDATA/PG_VERSION` != '7.3' ]
then
SYSDOCDIR="(Your System's documentation
directory)"
if [ -d /usr/doc/postgresql-$PGVERSION ]
then
SYSDOCDIR=/usr/doc
fi
if [ -d /usr/share/doc/postgresql-$PGVERSION ]
then
SYSDOCDIR=/usr/share/doc
fi
if [ -d /usr/doc/packages/postgresql-$PGVERSION
]
then
SYSDOCDIR=/usr/doc/packages
fi
if [ -d
/usr/share/doc/packages/postgresql-$PGVERSION ]
then
SYSDOCDIR=/usr/share/doc/packages
fi
echo
echo $"An old version of the database format was
found.\nYou need to upgrade the data format before using
PostgreSQL.\nSee $SYSDOCDIR/postgresql-$PGVERSION/README.rpm-dist for
more information."
exit 1
fi
# No existing PGDATA! Initdb it.
else
echo -n $"Initializing database: "
if [ ! -d $PGDATA ]
then
mkdir -p $PGDATA
chown postgres.postgres $PGDATA
chmod go-rwx $PGDATA
fi
# Make sure the locale from the initdb is preserved for
later startups...
[ -f /etc/sysconfig/i18n ] && cp /etc/sysconfig/i18n
$PGDATA/../initdb.i18n
# Just in case no locale was set, use en_US
[ ! -f /etc/sysconfig/i18n ] && echo "LANG=en_US" >
$PGDATA/../initdb.i18n
# Is expanded this early to be used in the command su
runs
echo "export LANG LC_ALL LC_CTYPE LC_COLLATE LC_NUMERIC
LC_CTYPE LC_TIME" >> $PGDATA/../initdb.i18n
# Initialize the database
su -l postgres -s /bin/sh -c "/usr/bin/initdb
--pgdata=$PGDATA > /dev/null 2>&1" < /dev/null
[ -f $PGDATA/PG_VERSION ] && echo_success
[ ! -f $PGDATA/PG_VERSION ] && echo_failure
echo
fi
# Check for postmaster already running...
# note that pg_ctl only looks at the data structures in PGDATA
# you really do need the pidof()
pid=`pidof -s /usr/bin/postmaster`
if [ $pid ] && /usr/bin/pg_ctl status -D $PGDATA > /dev/null
2>&1
then
echo $"Postmaster already running."
else
#all systems go -- remove any stale lock files
rm -f /tmp/.s.PGSQL.${PGPORT} > /dev/null
echo -n "$PSQL_START"
su -l postgres -s /bin/sh -c "/usr/bin/pg_ctl -D
$PGDATA -p /usr/bin/postmaster -o '-p ${PGPORT}' start > /dev/null
2>&1" < /dev/null
sleep 1
pid=`pidof -s /usr/bin/postmaster`
if [ $pid ]
then
if echo "$TYPESET"|grep "declare -f success"
/dev/null
then
success "$PSQL_START"
else
echo " [ OK ]"
fi
touch /var/lock/subsys/${NAME}
echo $pid > /var/run/postmaster.${PGPORT}.pid
echo
else
if echo "$TYPESET"|grep "declare -f failure"
/dev/null
then
failure "$PSQL_START"
else
echo " [ FAILED ]"
fi
echo
fi
fi
}
stop(){
PSQL_STOP=$"Stopping ${NAME} service: "
su -l postgres -s /bin/sh -c "/usr/bin/pg_ctl stop -D $PGDATA -s
-m fast" > /dev/null 2>&1
ret=$?
if [ $ret -eq 0 ]
then
if echo "$TYPESET"|grep "declare -f success" >/dev/null
then
success "$PSQL_STOP"
else
echo " [ OK ]"
fi
else
if echo "$TYPESET"|grep "declare -f failure" >/dev/null
then
failure "$PSQL_START"
else
echo " [ FAILED ]"
fi
fi
echo
rm -f /var/run/postmaster.${PGPORT}.pid
rm -f /var/lock/subsys/${NAME}
}
restart(){
stop
start
}
condrestart(){
[ -e /var/lock/subsys/${NAME} ] && restart
}
reload(){
su -l postgres -s /bin/sh -c "/usr/bin/pg_ctl reload -D $PGDATA -s"
/dev/null 2>&1
}
# This script is slightly unusual in that the name of the daemon
(postmaster)
# is not the same as the name of the subsystem (postgresql)
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status postmaster
;;
restart)
restart
;;
condrestart)
condrestart
;;
reload|force-reload)
reload
;;
*)
echo $"Usage: $0
{start|stop|status|restart|condrestart|reload|force-reload}"
exit 1
esac
exit 0
-----Original Message-----
From: scott.marlowe [mailto:scott.marlowe@ihs.com]
Sent: Monday, June 23, 2003 4:20 PM
To: Carlos
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] Eliminating start error message: "unary operator
Could you post a copy of the /etc/rc.d/init.d/postgresql file here? It
may have gotten corrupted or have a simple syntax error in it.
On Mon, 23 Jun 2003, Carlos Oliva wrote:
Postgresql was installed from RPMS, downloaded from the following url:
ftp://ftp5.us.postgresql.org/pub/PostgreSQL/binary/v7.3.2/RPMS/redhat-
7.
3/
The startup script was created when the rpms were installed.-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org] On Behalf Of scott.marlowe
Sent: Monday, June 23, 2003 3:35 PM
To: Carlos
Cc: 'pgsql-general@postgresql.org'
Subject: Re: [GENERAL] Eliminating start error message: "unary
operatorOn Mon, 23 Jun 2003, Carlos wrote:
Hi Forum,
What should I correct in order to eliminate the following error
message on
start:
Executing /etc/rc.d/init.d/postgresql start ..
Starting postgresql service: -sh: [: ==: unary operator expected
[ OK ]We installed a v7.3.2 and PostgreSQL seems to be running very well
butwe want to get rid of this message.
How did you install postgresql (rpms, source code) and where did the
startup script come from?---------------------------(end of
broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?http://www.postgresql.org/docs/faqs/FAQ.html
---------------------------(end of
broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to
majordomo@postgresql.org)
Show quoted text
Attachments:
postscript.txttext/plain; name=postscript.txtDownload
Import Notes
Reply to msg id not found: E148BE531B8AD311922E005004D3EEA101E5668A@xchserver.pbsinet.com | Resolved by subject fallback
"Carlos Oliva" <carlos@pbsinet.com> writes:
There it goes. I also enclosed it in a text file.
There's nothing obviously wrong there ... maybe the problem is in one
of the files it includes?
I'd suggest running the script by hand via "sh -x initscript" so we
can determine exactly which line is causing the problem.
regards, tom lane
Hi Tom,
I got this in standard out. I also included the output in a text file
I run the following command:
sh -x /etc/rc.d/init.d/postgresql start
Thanks for your help
+ PGVERSION=7.3
+ INITD=/etc/rc.d/init.d
+ . /etc/rc.d/init.d/functions
++ TEXTDOMAIN=initscripts
++ TEXTDOMAINDIR=/etc/locale
++ umask 022
++ export PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin
++ PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin
++ '[' -z '' ']'
++ COLUMNS=80
++ '[' -f /etc/sysconfig/i18n -a -z '' ']'
++ . /etc/sysconfig/i18n
+++ LANG=en_US.iso885915
+++ SUPPORTED=en_US.iso885915:en_US:en
+++ SYSFONT=lat0-sun16
+++ SYSFONTACM=iso15
+++ /sbin/consoletype
++ '[' en_US.iso885915 = ja_JP.eucJP -a pty '!=' pty ']'
+++ /sbin/consoletype
++ '[' en_US.iso885915 = ko_KR.eucKR -a pty '!=' pty ']'
+++ /sbin/consoletype
++ '[' en_US.iso885915 = zh_CN.GB2312 -a pty '!=' pty ']'
+++ /sbin/consoletype
++ '[' en_US.iso885915 = zh_TW.Big5 -a pty '!=' pty ']'
++ export LANG
++ '[' -z '' ']'
++ '[' -f /etc/sysconfig/init ']'
++ . /etc/sysconfig/init
+++ BOOTUP=color
+++ RES_COL=60
+++ MOVE_TO_COL=echo -en \033[60G
+++ SETCOLOR_SUCCESS=echo -en \033[1;32m
+++ SETCOLOR_FAILURE=echo -en \033[1;31m
+++ SETCOLOR_WARNING=echo -en \033[1;33m
+++ SETCOLOR_NORMAL=echo -en \033[0;39m
+++ LOGLEVEL=3
+++ PROMPT=yes
++ '[' -x /sbin/consoletype ']'
+++ consoletype
++ '[' pty = serial ']'
++ '[' color '!=' verbose ']'
++ INITLOG_ARGS=-q
++ typeset -F
+ TYPESET=declare -f action
declare -f checkpid
declare -f confirm
declare -f daemon
declare -f echo_failure
declare -f echo_passed
declare -f echo_success
declare -f echo_warning
declare -f failure
declare -f killproc
declare -f passed
declare -f pidfileofproc
declare -f pidofproc
declare -f status
declare -f strstr
declare -f success
declare -f warning
+ . /etc/sysconfig/network
++ NETWORKING=yes
++ HOSTNAME=buyemr.pbsinet.com
++ GATEWAY=209.4.117.159
++ basename /etc/rc.d/init.d/postgresql
+ NAME=postgresql
+ PGPORT=5432
+ export PGDATA=/var/lib/pgsql
+ PGDATA=/var/lib/pgsql
+ '[' -f /var/lib/pgsql/PG_VERSION ']'
+ export PGDATA=/var/lib/pgsql/data
+ PGDATA=/var/lib/pgsql/data
+ '[' -f /etc/sysconfig/pgsql/postgresql ']'
+ export PGDATA
+ export PGPORT
+ export PGOPTS
+ '[' yes = no ']'
+ '[' -f /usr/bin/postmaster ']'
+ start
+ PSQL_START=Starting postgresql service:
+ '[' -f /var/lib/pgsql/data/PG_VERSION ']'
+ '[' -d /var/lib/pgsql/data/base ']'
++ cat /var/lib/pgsql/data/PG_VERSION
+ '[' 7.3 '!=' 7.3 ']'
++ pidof -s /usr/bin/postmaster
+ pid=
+ '[' ']'
+ rm -f /tmp/.s.PGSQL.5432
+ echo -n 'Starting postgresql service: '
Starting postgresql service: + su -l postgres -s /bin/sh -c
'/usr/bin/pg_ctl -D
/var/lib/pgsql/data -p /usr/bin/postmaster -o '\''-p 5432'\'' start >
/dev/nul
l 2>&1'
standard in must be a tty
+ sleep 1
++ pidof -s /usr/bin/postmaster
+ pid=
+ '[' ']'
+ echo 'declare -f action
declare -f checkpid
declare -f confirm
declare -f daemon
declare -f echo_failure
declare -f echo_passed
declare -f echo_success
declare -f echo_warning
declare -f failure
declare -f killproc
declare -f passed
declare -f pidfileofproc
declare -f pidofproc
declare -f status
declare -f strstr
declare -f success
declare -f warning'
+ grep 'declare -f failure'
+ failure 'Starting postgresql service: '
+ rc=0
+ '[' -z '' ']'
+ initlog -q -n /etc/rc.d/init.d/postgresql -s 'Starting postgresql
service: ' -
e 2
+ '[' color '!=' verbose -a -z '' ']'
+ echo_failure
+ '[' color = color ']'
+ echo -en '\033[60G'
+ echo -n '['
[+ '[' color = color ']'
+ echo -en '\033[1;31m'
+ echo -n FAILED
FAILED+ '[' color = color ']'
+ echo -en '\033[0;39m'
+ echo -n ']'
]+ echo -ne '\r'
+ return 1
+ return 0
+ echo
+ exit 0
-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org] On Behalf Of Tom Lane
Sent: Monday, June 23, 2003 4:46 PM
To: Carlos
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] Eliminating start error message: "unary operator
"Carlos Oliva" <carlos@pbsinet.com> writes:
There it goes. I also enclosed it in a text file.
There's nothing obviously wrong there ... maybe the problem is in one of
the files it includes?
I'd suggest running the script by hand via "sh -x initscript" so we can
determine exactly which line is causing the problem.
regards, tom lane
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?
Attachments:
posterror.txttext/plain; name=posterror.txtDownload
Import Notes
Reply to msg id not found: E148BE531B8AD311922E005004D3EEA101E56692@xchserver.pbsinet.com | Resolved by subject fallback
"Carlos Oliva" <carlos@pbsinet.com> writes:
I got this in standard out. I also included the output in a text file
I don't see the complaint anywhere in there, though?
Also, it looks like this failed because postmaster was already running.
You probably need to stop the postmaster and then try the sh -x.
Don't forget to pipe both stdout and stderr into the same file, eg
sh -x /etc/rc.d/init.d/postgresql start >mylog 2>&1
regards, tom lane
On Mon, 23 Jun 2003 15:16:28 -0400
Carlos <Carlos@pbsinet.com> wrote:
start:
Executing /etc/rc.d/init.d/postgresql start ..
Starting postgresql service: -sh: [: ==: unary operator expected
[ OK ]
do:
ls -l /bin/sh
it is supposed to be a symlink pointing fo /bin/bash
if it's not, check if you do have /bin/bash and do:
1. change symlink /bin/sh to point to /bin/bash
or
2. change startup script to use bash instead.
that should help.
depesz
--
Hi Tom,
This log has the error but I do not understand why it occurs. Attached
is the file also
+ PGVERSION=7.3
+ INITD=/etc/rc.d/init.d
+ . /etc/rc.d/init.d/functions
++ TEXTDOMAIN=initscripts
++ TEXTDOMAINDIR=/etc/locale
++ umask 022
++ export PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin
++ PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin
++ '[' -z '' ']'
++ COLUMNS=80
++ '[' -f /etc/sysconfig/i18n -a -z '' ']'
++ . /etc/sysconfig/i18n
+++ LANG=en_US.iso885915
+++ SUPPORTED=en_US.iso885915:en_US:en
+++ SYSFONT=lat0-sun16
+++ SYSFONTACM=iso15
+++ /sbin/consoletype
++ '[' en_US.iso885915 = ja_JP.eucJP -a pty '!=' pty ']'
+++ /sbin/consoletype
++ '[' en_US.iso885915 = ko_KR.eucKR -a pty '!=' pty ']'
+++ /sbin/consoletype
++ '[' en_US.iso885915 = zh_CN.GB2312 -a pty '!=' pty ']'
+++ /sbin/consoletype
++ '[' en_US.iso885915 = zh_TW.Big5 -a pty '!=' pty ']'
++ export LANG
++ '[' -z '' ']'
++ '[' -f /etc/sysconfig/init ']'
++ . /etc/sysconfig/init
+++ BOOTUP=color
+++ RES_COL=60
+++ MOVE_TO_COL=echo -en \033[60G
+++ SETCOLOR_SUCCESS=echo -en \033[1;32m
+++ SETCOLOR_FAILURE=echo -en \033[1;31m
+++ SETCOLOR_WARNING=echo -en \033[1;33m
+++ SETCOLOR_NORMAL=echo -en \033[0;39m
+++ LOGLEVEL=3
+++ PROMPT=yes
++ '[' -x /sbin/consoletype ']'
+++ consoletype
++ '[' pty = serial ']'
++ '[' color '!=' verbose ']'
++ INITLOG_ARGS=-q
++ typeset -F
+ TYPESET=declare -f action
declare -f checkpid
declare -f confirm
declare -f daemon
declare -f echo_failure
declare -f echo_passed
declare -f echo_success
declare -f echo_warning
declare -f failure
declare -f killproc
declare -f passed
declare -f pidfileofproc
declare -f pidofproc
declare -f status
declare -f strstr
declare -f success
declare -f warning
+ . /etc/sysconfig/network
++ NETWORKING=yes
++ HOSTNAME=buyemr.pbsinet.com
++ GATEWAY=209.4.117.159
++ basename /etc/rc.d/init.d/postgresql
+ NAME=postgresql
+ PGPORT=5432
+ export PGDATA=/var/lib/pgsql
+ PGDATA=/var/lib/pgsql
+ '[' -f /var/lib/pgsql/PG_VERSION ']'
+ export PGDATA=/var/lib/pgsql/data
+ PGDATA=/var/lib/pgsql/data
+ '[' -f /etc/sysconfig/pgsql/postgresql ']'
+ export PGDATA
+ export PGPORT
+ export PGOPTS
+ '[' yes = no ']'
+ '[' -f /usr/bin/postmaster ']'
+ start
+ PSQL_START=Starting postgresql service:
+ '[' -f /var/lib/pgsql/data/PG_VERSION ']'
+ '[' -d /var/lib/pgsql/data/base ']'
++ cat /var/lib/pgsql/data/PG_VERSION
+ '[' 7.3 '!=' 7.3 ']'
++ pidof -s /usr/bin/postmaster
+ pid=
+ '[' ']'
+ rm -f /tmp/.s.PGSQL.5432
+ echo -n 'Starting postgresql service: '
Starting postgresql service: + su -l postgres -s /bin/sh -c
'/usr/bin/pg_ctl -D /var/lib/pgsql/data -p /usr/bin/postmaster -o
'\''-p 5432'\'' start > /dev/null 2>&1'
-sh: [: ==: unary operator expected
+ sleep 1
++ pidof -s /usr/bin/postmaster
+ pid=6350
+ '[' 6350 ']'
+ echo 'declare -f action
declare -f checkpid
declare -f confirm
declare -f daemon
declare -f echo_failure
declare -f echo_passed
declare -f echo_success
declare -f echo_warning
declare -f failure
declare -f killproc
declare -f passed
declare -f pidfileofproc
declare -f pidofproc
declare -f status
declare -f strstr
declare -f success
declare -f warning'
+ grep 'declare -f success'
+ success 'Starting postgresql service: '
+ '[' -z '' ']'
+ initlog -q -n /etc/rc.d/init.d/postgresql -s 'Starting postgresql
service: ' -e 1
+ '[' color '!=' verbose -a -z '' ']'
+ echo_success
+ '[' color = color ']'
+ echo -en '\033[60G'
[60G+ echo -n '[ '
[ + '[' color = color ']'
+ echo -en '\033[1;32m'
[1;32m+ echo -n OK
OK+ '[' color = color ']'
+ echo -en '\033[0;39m'
[0;39m+ echo -n ' ]'
]+ echo -ne '\r'
+ return 0
+ return 0
+ touch /var/lock/subsys/postgresql
+ echo 6350
+ echo
+ exit 0
-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org] On Behalf Of Tom Lane
Sent: Monday, June 23, 2003 5:18 PM
To: Carlos
Cc: pgsql-general@postgresql.org; Dain
Subject: Re: [GENERAL] Eliminating start error message: "unary operator
"Carlos Oliva" <carlos@pbsinet.com> writes:
I got this in standard out. I also included the output in a text file
I don't see the complaint anywhere in there, though?
Also, it looks like this failed because postmaster was already running.
You probably need to stop the postmaster and then try the sh -x. Don't
forget to pipe both stdout and stderr into the same file, eg
sh -x /etc/rc.d/init.d/postgresql start >mylog 2>&1
regards, tom lane
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly
Attachments:
mylog.txttext/plain; name=mylog.txtDownload
Import Notes
Reply to msg id not found: E148BE531B8AD311922E005004D3EEA101E56699@xchserver.pbsinet.com | Resolved by subject fallback
"Carlos Oliva" <carlos@pbsinet.com> writes:
This log has the error but I do not understand why it occurs.
Starting postgresql service: + su -l postgres -s /bin/sh -c
'/usr/bin/pg_ctl -D /var/lib/pgsql/data -p /usr/bin/postmaster -o
'\''-p 5432'\'' start > /dev/null 2>&1'
-sh: [: ==: unary operator expected
Hm. Apparently the error is actually occuring inside the pg_ctl script.
Try changing the above line in the initscript to do
/bin/sh -c "/bin/sh -x /usr/bin/pg_ctl ..."
so we can get tracing of the pg_ctl script too.
(I am now thinking that the error probably occurs because pg_ctl is
expecting some environment variable to be set that is not set when run
from the boot script? If so, you might not see the failure if you try
to run pg_ctl by hand with sh -x. But you could try that first if you
like.)
regards, tom lane
Hi Tom,
Thank you very much for your help. In order to get the pg_ctl trace at
start up, I would appreciate it if you could advise me on how to modify
the postscrpt script. The line in question in the script is:
su -l postgres -s /bin/sh -c "/usr/bin/pg_ctl -D $PGDATA -p
/usr/bin/postmaster -o '-p ${PGPORT}' start > /dev/null 2>&1" <
/dev/null
Should it be something like:
su -l postgres -s /bin/sh -c "/bin/sh -x /usr/bin/pg_ctl -D $PGDATA -p
/usr/bin/postmaster -o '-p ${PGPORT}' start > mylog 2>&1" < /dev/null
Thanks in advance for your response.
-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org] On Behalf Of Tom Lane
Sent: Tuesday, June 24, 2003 10:32 AM
To: Carlos
Cc: pgsql-general@postgresql.org; Dain
Subject: Re: [GENERAL] Eliminating start error message: "unary operator
"Carlos Oliva" <carlos@pbsinet.com> writes:
This log has the error but I do not understand why it occurs.
Starting postgresql service: + su -l postgres -s /bin/sh -c
'/usr/bin/pg_ctl -D /var/lib/pgsql/data -p /usr/bin/postmaster -o
'\''-p 5432'\'' start > /dev/null 2>&1'
-sh: [: ==: unary operator expected
Hm. Apparently the error is actually occuring inside the pg_ctl script.
Try changing the above line in the initscript to do
/bin/sh -c "/bin/sh -x /usr/bin/pg_ctl ..."
so we can get tracing of the pg_ctl script too.
(I am now thinking that the error probably occurs because pg_ctl is
expecting some environment variable to be set that is not set when run
from the boot script? If so, you might not see the failure if you try
to run pg_ctl by hand with sh -x. But you could try that first if you
like.)
regards, tom lane
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?
Import Notes
Reply to msg id not found: E148BE531B8AD311922E005004D3EEA101E566D8@xchserver.pbsinet.com | Resolved by subject fallback
Hi Tom,
I got the following log when I tried to output the messages from pg_ctl
(enclosed is the text file also). I modified the postscript script to get
the log writeeen at bootup. The line of postscript script that I modified
was:
su -l postgres -s /bin/sh -c "/usr/bin/pg_ctl -D $PGDATA -p
/usr/bin/postmaster -o '-p ${PGPORT}' start > /dev/null 2>&1" < /dev/null
To:
su -l postgres -s /bin/sh -c "/bin/sh -x /usr/bin/pg_ctl -D $PGDATA -p
/usr/bin/postmaster -o '-p ${PGPORT}' start > /tmp/mylog 2>&1" < /dev/null
Indeed, I do not see an error anywhere.
++ basename /usr/bin/pg_ctl
+ CMDNAME=pg_ctl
+ help=pg_ctl is a utility to start, stop, restart, reload configuration
files,
or report the status of a PostgreSQL server.
Usage:
pg_ctl start [-w] [-D DATADIR] [-s] [-l FILENAME] [-o "OPTIONS"]
pg_ctl stop [-W] [-D DATADIR] [-s] [-m SHUTDOWN-MODE]
pg_ctl restart [-w] [-D DATADIR] [-s] [-m SHUTDOWN-MODE] [-o "OPTIONS"]
pg_ctl reload [-D DATADIR] [-s]
pg_ctl status [-D DATADIR]
Common options:
-D DATADIR location of the database storage area
-s only print errors, no informational messages
-w wait until operation completes
-W do not wait until operation completes
--help show this help, then exit
--version output version information, then exit
(The default is to wait for shutdown, but not for start or restart.)
If the -D option is omitted, the environment variable PGDATA is used.
Options for start or restart:
-l FILENAME write (or append) server log to FILENAME. The
use of this option is highly recommended.
-o OPTIONS command line options to pass to the postmaster
(PostgreSQL server executable)
-p PATH-TO-POSTMASTER normally not necessary
Options for stop or restart:
-m SHUTDOWN-MODE may be 'smart', 'fast', or 'immediate'
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 on
restart
Report bugs to <pgsql-bugs@postgresql.org>.
+ advice=Try 'pg_ctl --help' for more information.
+ bindir=/usr/bin
+ VERSION=7.3.2
+ umask 077
+ echo '\c'
+ grep -s c
+ ECHO_N=echo -n
+ ECHO_C=
+ echo /usr/bin/pg_ctl
+ grep /
++ echo /usr/bin/pg_ctl
++ sed 's,/[^/]*$,,'
+ self_path=/usr/bin
+ '[' -x /usr/bin/postmaster ']'
+ '[' -x /usr/bin/psql ']'
+ PGPATH=/usr/bin
+ po_path=/usr/bin/postmaster
+ wait=
+ wait_seconds=60
+ logfile=
+ silence_echo=
+ shutdown_mode=smart
+ '[' 7 -gt 0 ']'
+ shift
+ PGDATA=/var/lib/pgsql/data
+ export PGDATA
+ shift
+ '[' 5 -gt 0 ']'
+ shift
+ po_path=/usr/bin/postmaster
+ shift
+ '[' 3 -gt 0 ']'
+ shift
+ POSTOPTS=-p 5432
+ shift
+ '[' 1 -gt 0 ']'
+ op=start
+ shift
+ '[' 0 -gt 0 ']'
+ '[' xstart = x ']'
+ '[' -z /var/lib/pgsql/data ']'
+ '[' -z '' ']'
+ wait=no
+ sig=-TERM
+ '[' start = reload ']'
+ DEFPOSTOPTS=/var/lib/pgsql/data/postmaster.opts.default
+ POSTOPTSFILE=/var/lib/pgsql/data/postmaster.opts
+ PIDFILE=/var/lib/pgsql/data/postmaster.pid
+ '[' start = status ']'
+ '[' start = stop -o start = restart -o start = reload ']'
+ '[' start = start -o start = restart ']'
+ oldpid=
+ '[' -f /var/lib/pgsql/data/postmaster.pid ']'
+ '[' -z '-p 5432' ']'
+ eval set X '-p 5432'
++ set X -p 5432
+ shift
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' no = yes ']'
+ echo 'postmaster successfully started'
postmaster successfully started
+ exit 0
+ /usr/bin/postmaster -p 5432
LOG: database system was shut down at 2003-06-25 13:04:50 EDT
LOG: checkpoint record is at 0/12155DD8
LOG: redo record is at 0/12155DD8; undo record is at 0/0; shutdown TRUE
LOG: next transaction id: 3002; next oid: 632310
LOG: database system is ready
-----Original Message-----
From: Carlos
Sent: Tuesday, June 24, 2003 1:56 PM
To: 'Tom Lane'; Carlos
Cc: 'pgsql-general@postgresql.org'; Dain
Subject: RE: [GENERAL] Eliminating start error message: "unary operator
Hi Tom,
Thank you very much for your help. In order to get the pg_ctl trace at
start up, I would appreciate it if you could advise me on how to modify the
postscrpt script. The line in question in the script is: su -l postgres -s
/bin/sh -c "/usr/bin/pg_ctl -D $PGDATA -p /usr/bin/postmaster -o '-p
${PGPORT}' start > /dev/null 2>&1" < /dev/null
Should it be something like:
su -l postgres -s /bin/sh -c "/bin/sh -x /usr/bin/pg_ctl -D $PGDATA -p
/usr/bin/postmaster -o '-p ${PGPORT}' start > mylog 2>&1" < /dev/null
Thanks in advance for your response.
-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org] On Behalf Of Tom Lane
Sent: Tuesday, June 24, 2003 10:32 AM
To: Carlos
Cc: pgsql-general@postgresql.org; Dain
Subject: Re: [GENERAL] Eliminating start error message: "unary operator
"Carlos Oliva" <carlos@pbsinet.com> writes:
This log has the error but I do not understand why it occurs.
Starting postgresql service: + su -l postgres -s /bin/sh -c
'/usr/bin/pg_ctl -D /var/lib/pgsql/data -p /usr/bin/postmaster -o
'\''-p 5432'\'' start > /dev/null 2>&1'
-sh: [: ==: unary operator expected
Hm. Apparently the error is actually occuring inside the pg_ctl script. Try
changing the above line in the initscript to do
/bin/sh -c "/bin/sh -x /usr/bin/pg_ctl ..."
so we can get tracing of the pg_ctl script too.
(I am now thinking that the error probably occurs because pg_ctl is
expecting some environment variable to be set that is not set when run from
the boot script? If so, you might not see the failure if you try to run
pg_ctl by hand with sh -x. But you could try that first if you
like.)
regards, tom lane
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?
Import Notes
Resolved by subject fallback