Thread: Postgres not starting at boot(FreeBSD) - startup script not releasing

Try this on for size...   recently during a reboot (first in about 3 months for
this particular server) our entire rc.d directory failed to start...  after some
hacking of the rc file to output some helpful debuggin, it was apparent that the
010.pgsql.sh script in /usr/local/etc/rc.d was timing out and causing any
directives thereafter not to be processed.

Running the script manually as root starts the postmaster but doesn't return you
to the command prompt. ^C and checking the errlog shows

Waiting for postmaster starting up..DEBUG:  Data Base System is starting up at
Sat Mar  9 17:05:45 2002
DEBUG:  Data Base System was shut down at Sat Mar  9 17:05:39 2002
DEBUG:  Data Base System is in production state at Sat Mar  9 17:05:45 2002
Fast Shutdown request at Sat Mar  9 17:05:48 2002
DEBUG:  Data Base System shutting down at Sat Mar  9 17:05:48 2002
DEBUG:  Data Base System shut down at Sat Mar  9 17:05:48 2002

Can force it to return to command prompt by adding a "&" and doublt cr

web1# /usr/local/etc/rc.d/010.pgsql.sh start &
[1] 4635
web1#
[1]  + Suspended (tty output)        /usr/local/etc/rc.d/010.pgsql.sh start
web1#

and postgres stays up and frees the terminal.  Output in errlog for this is...

Waiting for postmaster starting up..DEBUG:  Data Base System is starting up at
Sat Mar  9 17:07:21 2002
DEBUG:  Data Base System was shut down at Sat Mar  9 17:05:48 2002
DEBUG:  Data Base System is in production state at Sat Mar  9 17:07:21 2002

No idea what could be causing the script not to function as it is the EXACT same
script as on the other servers we are operating (did a diff just to be sure)

In the interim we removed the script from the startup dir...   any ideas as to
why this is occuring?

Installed from port, left the port startup script as is... listed below.
Appreciate any feedback/comments.

Dave

# $FreeBSD: ports/databases/postgresql7/files/pgsql.sh.tmpl,v 1.9 2000/12/11
03:22:07 steve Exp $
#
# For postmaster startup options, edit $PGDATA/postmaster.opts.default
# Preinstalled options are -i -o "-F"

case $1 in
start)
    [ -d /usr/local/pgsql/lib ] && /sbin/ldconfig -m /usr/local/pgsql/lib
    [ -x /usr/local/pgsql/bin/pg_ctl ] && {
        su -l pgsql -c \
            'exec /usr/local/pgsql/bin/pg_ctl -w start > /usr/local/pgsql/errlog
2>&1'
        echo -n ' pgsql'
    }
    ;;

stop)
    [ -x /usr/local/pgsql/bin/pg_ctl ] && {
        exec su -l pgsql -c 'exec /usr/local/pgsql/bin/pg_ctl -w -m fast stop'
    }
    ;;

status)
    [ -x /usr/local/pgsql/bin/pg_ctl ] && {
        exec su -l pgsql -c 'exec /usr/local/pgsql/bin/pg_ctl status'
    }
    ;;

*)
    echo "usage: `basename $0` {start|stop|status}" >&2
    exit 64
    ;;
esac


Re: Postgres not starting at boot(FreeBSD) - startup script

From
Francisco Reyes
Date:
On Sun, 10 Mar 2002, Dave wrote:

> Try this on for size...   recently during a reboot (first in about 3 months for
> this particular server) our entire rc.d directory failed to start...  after some
> hacking of the rc file to output some helpful debuggin, it was apparent that the
> 010.pgsql.sh script in /usr/local/etc/rc.d was timing out and causing any
> directives thereafter not to be processed.

have you tried manually doing "pg_ctl restart" to see if any problems
pop-up? Maybe it is not a script error, but some other issue with the db
server.


Re: Postgres not starting at boot(FreeBSD) - startup script

From
"Dave"
Date:
>> Try this on for size...   recently during a reboot (first in about 3
>months for
>> this particular server) our entire rc.d directory failed to start...
> after some
>> hacking of the rc file to output some helpful debuggin, it was
>apparent that the
>> 010.pgsql.sh script in /usr/local/etc/rc.d was timing out and causing any
>> directives thereafter not to be processed.
>
>have you tried manually doing "pg_ctl restart" to see if any problems
>pop-up? Maybe it is not a script error, but some other issue with the db
>server.

restart works fine...  though I have to press enter to get back to command
prompt

web5# exec su -l pgsql -c 'exec /usr/local/pgsql/bin/pg_ctl restart'
Waiting for postmaster shutting down...done.
postmaster successfully shut down.
postmaster successfully started up.
> DEBUG:  Data Base System is starting up at Sun Mar 10 14:16:47 2002
DEBUG:  Data Base System was shut down at Sun Mar 10 14:16:46 2002
DEBUG:  Data Base System is in production state at Sun Mar 10 14:16:47 2002

perplexed.

Dave


Re: Postgres not starting at boot(FreeBSD) - startup script

From
"Dave"
Date:
hold the farm...

>>> Try this on for size...   recently during a reboot (first in about 3
>>months for
>>> this particular server) our entire rc.d directory failed to start...
>> after some
>>> hacking of the rc file to output some helpful debuggin, it was
>>apparent that the
>>> 010.pgsql.sh script in /usr/local/etc/rc.d was timing out and causing any
>>> directives thereafter not to be processed.
>>
>>have you tried manually doing "pg_ctl restart" to see if any problems
>>pop-up? Maybe it is not a script error, but some other issue with the db
>>server.

did the following,  stopped the server totally...  then ran the following.

web5# su -l pgsql -c 'exec /usr/local/pgsql/bin/pg_ctl start'
postmaster successfully started up.
web5# DEBUG:  Data Base System is starting up at Sun Mar 10 14:32:46 2002
DEBUG:  Data Base System was shut down at Sun Mar 10 14:32:04 2002
DEBUG:  Data Base System is in production state at Sun Mar 10 14:32:46 2002

web5#
web5# su -l pgsql -c 'exec /usr/local/pgsql/bin/pg_ctl restart'
Smart Shutdown request at Sun Mar 10 14:33:25 2002
Waiting for postmaster shutting down..................................The Data
Base System is shutting down
..........The Data Base System is shutting down
...The Data Base System is shutting down
....The Data Base System is shutting down
...The Data Base System is shutting down
.........pg_ctl: postmaster does not shut down
web5# The Data Base System is shutting down
The Data Base System is shutting down
The Data Base System is shutting down
The Data Base System is shutting down

    Hmmm...  check that its still running...

web5# ps -aux | grep pgsql
pgsql  81016  0.0  0.1   628  452  p0  I     2:32PM   0:00.00 /bin/sh /usr/loca
pgsql  81018  0.0  0.3  4080 2404  p0  I     2:32PM   0:00.03 /usr/local/pgsql/
pgsql  81082  0.0  0.4  4508 3008  p0  I     2:33PM   0:00.03 /usr/local/pgsql/
pgsql  81083  0.0  0.4  4556 3364  p0  I     2:33PM   0:00.06 /usr/local/pgsql/
web5#

    ok, lets try and use the rc.d script...

web5# /usr/local/etc/rc.d/010* stop
Fast Shutdown request at Sun Mar 10 14:37:28 2002
Aborting any active transaction...
Waiting for postmaster shutting down..FATAL 1:  The system is shutting down
FATAL 1:  The system is shutting down
NOTICE:  AbortTransaction and not in in-progress state
.NOTICE:  AbortTransaction and not in in-progress state
DEBUG:  Data Base System shutting down at Sun Mar 10 14:37:28 2002
DEBUG:  Data Base System shut down at Sun Mar 10 14:37:28 2002
done.
postmaster successfully shut down.
web5#

    Thats interesting,  perhaps pg_ctl is hosed?

web5# ps -aux | grep pgsql
web5#


Ideas?

Dave


Re: Postgres not starting at boot(FreeBSD) - startup script

From
Francisco Reyes
Date:
On Sun, 10 Mar 2002, Dave wrote:

>     Thats interesting,  perhaps pg_ctl is hosed?
> web5# ps -aux | grep pgsql
> web5#
>
> Ideas?

Did you try re-installing postgresql?

Have you recently installed anything on the machine? (as in maybe a
library got over-written with something that postgresql may not like).