Thread: Re: Eliminating start error message: "unary operator

Re: Eliminating start error message: "unary operator

From
"Carlos Oliva"
Date:
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'
+ echo -n '[  '
[  + '[' color = color ']'
+ echo -en '\033[1;32m'
+ echo -n OK
OK+ '[' color = color ']'
+ echo -en '\033[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

Attachment

Re: Eliminating start error message: "unary operator

From
Tom Lane
Date:
"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