Re: Eliminating start error message: "unary operator - Mailing list pgsql-general

From Carlos
Subject Re: Eliminating start error message: "unary operator
Date
Msg-id E148BE531B8AD311922E005004D3EEA101D515F0@xchserver.pbsinet.com
Whole thread Raw
List pgsql-general

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?

               http://www.postgresql.org/docs/faqs/FAQ.html

pgsql-general by date:

Previous
From: "scott.marlowe"
Date:
Subject: Re: pg_statistic_relid_att_index
Next
From: "Reuben D. Budiardja"
Date:
Subject: INSERT WHERE NOT EXISTS