Thread: Automatic shutdown from Linux.
Hi all! I would like to automate the shutdown of my postgres database, just as I do with my startup. I have looked through the docs and I can't find anything that addresses this issue. I am sure that there are many out there who don't manually shutdwon the database prior to a system shutdown/reboot. Please advise. Sincerely, David Langschied Langschied Consulting Services 25644 Mackinac Roseville, MI 48066 Phone: (586)777-7542 Cell: (248)789-8493 e-mail: dlangschied@ameritech.net
On Fri, May 09, 2003 at 08:25:53 -0400, dlangschied <dlangschied@ameritech.net> wrote: > Hi all! > I would like to automate the shutdown of my postgres database, just as I do > with my startup. I have looked through the docs and I can't find anything > that addresses this issue. I am sure that there are many out there who > don't manually shutdwon the database prior to a system shutdown/reboot. > Please advise. > Sincerely, Probably the init scripts for your system already do this for you. If you system displays a message for each service being shutdown during a shutdown you should be able to watch and see if postgres is shutdown as part of that process.
Thanx! I didn't think of that, but I did notice in the log file that a smart shutdown had been performed. Sincerely, David Langschied Langschied Consulting Services 25644 Mackinac Roseville, MI 48066 Phone: (586)777-7542 Cell: (248)789-8493 e-mail: dlangschied@ameritech.net ----- Original Message ----- From: "Bruno Wolff III" <bruno@wolff.to> To: "dlangschied" <dlangschied@Ameritech.Net> Cc: <pgsql-admin@postgresql.org> Sent: Friday, May 09, 2003 8:56 AM Subject: Re: [ADMIN] Automatic shutdown from Linux. > On Fri, May 09, 2003 at 08:25:53 -0400, > dlangschied <dlangschied@ameritech.net> wrote: > > Hi all! > > I would like to automate the shutdown of my postgres database, just as I do > > with my startup. I have looked through the docs and I can't find anything > > that addresses this issue. I am sure that there are many out there who > > don't manually shutdwon the database prior to a system shutdown/reboot. > > Please advise. > > Sincerely, > > Probably the init scripts for your system already do this for you. > If you system displays a message for each service being shutdown > during a shutdown you should be able to watch and see if postgres > is shutdown as part of that process. > > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faqs/FAQ.html
Bruno Wolff III <bruno@wolff.to> writes: > Probably the init scripts for your system already do this for you. > If you system displays a message for each service being shutdown > during a shutdown you should be able to watch and see if postgres > is shutdown as part of that process. Also, in a conventionally-run Unix system the database will shut down cleanly even without any init-script help. This is because the postmaster and backends are designed (with malice aforethought ;-)) to interpret SIGTERM as a fast-shutdown request. Assuming that the kernel gives user processes a reasonable number of seconds between SIGTERM and SIGKILL --- enough for a checkpoint --- you don't really need anything else. One reason not to crank shared_buffers up to the moon is that with a huge number of dirty buffers, checkpoint might take too long for this scenario to be robust. On my HPUX box, the kernel will give twenty seconds' grace between SIGTERM and SIGKILL, which is enough for even a pretty messy checkpoint, but I dunno what the equivalent delay is on other platforms. regards, tom lane
On Friday 09 May 2003 13:26 in <002601c31626$229da170$6401a8c0@lcshost>, dlangschied (dlangschied@ameritech.net) wrote: > I would like to automate the shutdown of my postgres database, just as I > do with my startup. I wrote a start-up and shutdown script to be placed in /etc/init.d and symlinked into /etc/init.d/rc?.d, where "?" is your init run-level. There is also a small configuration script to be placed in /etc/sysconfig. You, or anybody else, may have a copy of them. These have been tested on SuSE 8.1 Pro, but should work on most other LINUX distros too. [If you are running W******, just ignore this follow-up.] -- Regards, Dave ====================================================== dwnoon@spamtrap.ntlworld.com (David W Noon) Remove spam trap to reply via e-mail. ======================================================