From: | Dmitry Morozovsky <marck(at)rinet(dot)ru> |
---|---|
To: | Dave <dave(at)hawk-systems(dot)com> |
Cc: | pgsql-admin(at)postgresql(dot)org |
Subject: | Re: Postgres not starting at boot(FreeBSD) - startup script |
Date: | 2002-03-10 19:46:47 |
Message-ID: | 20020310224537.Q79918-100000@woozle.rinet.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin pgsql-general |
On Sun, 10 Mar 2002, Dave wrote:
I use the following lines (at /usr/local/etc/rc.d/pgsql.sh)
-- 8< --
#!/bin/sh
PGBIN=/usr/local/pgsql/bin
cmd="$1"
: ${cmd:=start}
case $cmd in
start)
[ -d /usr/local/pgsql/lib ] && /sbin/ldconfig -m /usr/local/pgsql/lib
[ -x ${PGBIN}/pg_ctl ] && {
echo -n 'pgsql '
su -l pgsql -c \
'[ -d ${PGDATA} ] && exec /usr/local/pgsql/bin/pg_ctl start -s -l ~pgsql/log/errlog'
}
;;
stop)
[ -x ${PGBIN}/pg_ctl ] && {
echo -n 'pgsql '
su -l pgsql -c 'exec /usr/local/pgsql/bin/pg_ctl stop -s -m fast'
}
;;
status)
[ -x ${PGBIN}/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
-- 8< --
D> Try this on for size... recently during a reboot (first in about 3 months for
D> this particular server) our entire rc.d directory failed to start... after some
D> hacking of the rc file to output some helpful debuggin, it was apparent that the
D> 010.pgsql.sh script in /usr/local/etc/rc.d was timing out and causing any
D> directives thereafter not to be processed.
D>
D> Running the script manually as root starts the postmaster but doesn't return you
D> to the command prompt. ^C and checking the errlog shows
D>
D> Waiting for postmaster starting up..DEBUG: Data Base System is starting up at
D> Sat Mar 9 17:05:45 2002
D> DEBUG: Data Base System was shut down at Sat Mar 9 17:05:39 2002
D> DEBUG: Data Base System is in production state at Sat Mar 9 17:05:45 2002
D> Fast Shutdown request at Sat Mar 9 17:05:48 2002
D> DEBUG: Data Base System shutting down at Sat Mar 9 17:05:48 2002
D> DEBUG: Data Base System shut down at Sat Mar 9 17:05:48 2002
D>
D> Can force it to return to command prompt by adding a "&" and doublt cr
D>
D> web1# /usr/local/etc/rc.d/010.pgsql.sh start &
D> [1] 4635
D> web1#
D> [1] + Suspended (tty output) /usr/local/etc/rc.d/010.pgsql.sh start
D> web1#
D>
D> and postgres stays up and frees the terminal. Output in errlog for this is...
D>
D> Waiting for postmaster starting up..DEBUG: Data Base System is starting up at
D> Sat Mar 9 17:07:21 2002
D> DEBUG: Data Base System was shut down at Sat Mar 9 17:05:48 2002
D> DEBUG: Data Base System is in production state at Sat Mar 9 17:07:21 2002
D>
D> No idea what could be causing the script not to function as it is the EXACT same
D> script as on the other servers we are operating (did a diff just to be sure)
D>
D> In the interim we removed the script from the startup dir... any ideas as to
D> why this is occuring?
D>
D> Installed from port, left the port startup script as is... listed below.
D> Appreciate any feedback/comments.
D>
D> Dave
D>
D> # $FreeBSD: ports/databases/postgresql7/files/pgsql.sh.tmpl,v 1.9 2000/12/11
D> 03:22:07 steve Exp $
D> #
D> # For postmaster startup options, edit $PGDATA/postmaster.opts.default
D> # Preinstalled options are -i -o "-F"
D>
D> case $1 in
D> start)
D> [ -d /usr/local/pgsql/lib ] && /sbin/ldconfig -m /usr/local/pgsql/lib
D> [ -x /usr/local/pgsql/bin/pg_ctl ] && {
D> su -l pgsql -c \
D> 'exec /usr/local/pgsql/bin/pg_ctl -w start > /usr/local/pgsql/errlog
D> 2>&1'
D> echo -n ' pgsql'
D> }
D> ;;
D>
D> stop)
D> [ -x /usr/local/pgsql/bin/pg_ctl ] && {
D> exec su -l pgsql -c 'exec /usr/local/pgsql/bin/pg_ctl -w -m fast stop'
D> }
D> ;;
D>
D> status)
D> [ -x /usr/local/pgsql/bin/pg_ctl ] && {
D> exec su -l pgsql -c 'exec /usr/local/pgsql/bin/pg_ctl status'
D> }
D> ;;
D>
D> *)
D> echo "usage: `basename $0` {start|stop|status}" >&2
D> exit 64
D> ;;
D> esac
D>
D>
D> ---------------------------(end of broadcast)---------------------------
D> TIP 4: Don't 'kill -9' the postmaster
D>
Sincerely,
D.Marck [DM5020, DM268-RIPE, DM3-RIPN]
------------------------------------------------------------------------
*** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- marck(at)rinet(dot)ru ***
------------------------------------------------------------------------
From | Date | Subject | |
---|---|---|---|
Next Message | Matthew D. Fuller | 2002-03-10 20:38:24 | Re: Postgres not starting at boot(FreeBSD) - startup script not releasing |
Previous Message | Dave | 2002-03-10 19:39:16 | Re: Postgres not starting at boot(FreeBSD) - startup script not releasing |
From | Date | Subject | |
---|---|---|---|
Next Message | Neil Conway | 2002-03-10 19:55:07 | Re: Fsync on/off For Various Filesystems/Platforms |
Previous Message | Dave | 2002-03-10 19:39:16 | Re: Postgres not starting at boot(FreeBSD) - startup script not releasing |