Search Postgresql Archives

Re: Cannot Start Postgres After System Boot

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Rich Shepard <rshepard@xxxxxxxxxxxxxxx> writes:
>    The entire script is attached. It's only 2588 bytes.

Personally, I'd drop all the machinations with checking the pidfile or
removing old socket files.  The postmaster is fully capable of doing
those things for itself, and is much less likely to do them mistakenly
than this script is.  In particular, I wonder whether the script's
refusal to start if the pidfile already exists accounts for your
report that it fails to auto-restart after a reboot.

IOW, this:

> 		else # remove old socket, if it exists and no daemon is running.

> 			if [ ! -f $DATADIR/$PIDFILE ]; then
> 				rm -f /tmp/.s.PGSQL.5432
> 				rm -f /tmp/.s.PGSQL.5432.lock
> 				# pg_ctl start -w -l $LOGFILE -D $DATADIR
> 				su postgres -c 'postgres -D /var/lib/pgsql/data &'
> 				exit 0
> 			else
> 				echo "PostgreSQL daemon was not properly shut down"
> 				echo "Please remove stale pid file $DATADIR/$PIDFILE"
> 				exit 7
> 			fi

> 		fi	

could be reduced to just:

		else
			su postgres -c 'postgres -D /var/lib/pgsql/data &'
			exit 0
		fi

I'd also strongly recommend making that be "su - postgres -c ..."
rather than the way it is now; it's failing to ensure that the
postmaster is started with the postgres account's login settings.

I'm not sure about your comment that manual start attempts fail with
	LOG:  could not bind IPv4 socket: Address already in use
It's pretty hard to believe that that could occur on a freshly
booted system unless the TCP port was in fact already in use ---
ie, either there *is* a running postmaster, or something else is
using port 5432.

			regards, tom lane

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux