From 7dc5678e3aaeb15032c5b722103ab85a9ab2e0bd Mon Sep 17 00:00:00 2001 From: Tiziano Müller Date: Sun, 30 Mar 2008 19:22:49 +0000 Subject: dev-db/postgresql-server: Changed init.d/conf.d scripts to wait until the server started up/shut down completely. WAIT_FOR_{DISCONNET,CLEANUP,QUIT} should now work independently of the baselayout-version. svn path=/experimental/; revision=352 --- dev-db/postgresql-server/ChangeLog | 11 ++++++ dev-db/postgresql-server/Manifest | 26 ++++++------- dev-db/postgresql-server/files/postgresql.conf-7.3 | 11 ++++-- dev-db/postgresql-server/files/postgresql.conf-7.4 | 11 ++++-- dev-db/postgresql-server/files/postgresql.conf-8.0 | 11 ++++-- dev-db/postgresql-server/files/postgresql.conf-8.1 | 9 ++++- dev-db/postgresql-server/files/postgresql.conf-8.2 | 9 ++++- dev-db/postgresql-server/files/postgresql.conf-8.3 | 9 ++++- dev-db/postgresql-server/files/postgresql.init-7.3 | 43 +++++++++++++++------- dev-db/postgresql-server/files/postgresql.init-7.4 | 43 +++++++++++++++------- dev-db/postgresql-server/files/postgresql.init-8.0 | 43 +++++++++++++++------- dev-db/postgresql-server/files/postgresql.init-8.1 | 43 +++++++++++++++------- dev-db/postgresql-server/files/postgresql.init-8.2 | 43 +++++++++++++++------- dev-db/postgresql-server/files/postgresql.init-8.3 | 43 +++++++++++++++------- 14 files changed, 243 insertions(+), 112 deletions(-) diff --git a/dev-db/postgresql-server/ChangeLog b/dev-db/postgresql-server/ChangeLog index a0069e9..6879890 100644 --- a/dev-db/postgresql-server/ChangeLog +++ b/dev-db/postgresql-server/ChangeLog @@ -2,6 +2,17 @@ # Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2 # $Header: $ + 30 Mar 2008; Tiziano Müller + files/postgresql.init-7.3, files/postgresql.conf-7.3, + files/postgresql.init-7.4, files/postgresql.conf-7.4, + files/postgresql.init-8.0, files/postgresql.conf-8.0, + files/postgresql.init-8.1, files/postgresql.conf-8.1, + files/postgresql.init-8.2, files/postgresql.conf-8.2, + files/postgresql.init-8.3, files/postgresql.conf-8.3: + Changed init.d/conf.d scripts to wait until the server started up/shut down + completely. WAIT_FOR_{DISCONNET,CLEANUP,QUIT} should now work independently + of the baselayout-version. + 29 Mar 2008; Tiziano Müller postgresql-server-8.3.1.ebuild, files/postgresql-8.3-server.patch: Added uuid USE-flag, dependency and modified patch. Had to drop all keywords diff --git a/dev-db/postgresql-server/Manifest b/dev-db/postgresql-server/Manifest index f82fb1c..6be9c5f 100644 --- a/dev-db/postgresql-server/Manifest +++ b/dev-db/postgresql-server/Manifest @@ -14,18 +14,18 @@ AUX postgresql-8.2-common.patch 2640 RMD160 b25ba915d5d6ad9c12c1d51426363c196b83 AUX postgresql-8.2-server.patch 4849 RMD160 a1f625e9d0d19acaae63e75084185e32623dbcf6 SHA1 a481e9500cc8484a1bc454820aae5b8603451ba2 SHA256 be4ccf88103e92c5adcb065d3aaf10b9e60fad1962993d255965a6260ea3f595 AUX postgresql-8.3-common.patch 2641 RMD160 0822bf1512457e91d5f32f9d192de6f197db9c55 SHA1 e4bdbd5eee1023e8f0b42ef408b34b57495d1e2b SHA256 e416c26d9c3d266b306ddbc0a2b648054739b7ace35e2b4e449fbdaf094bc197 AUX postgresql-8.3-server.patch 6191 RMD160 d50a2fc599db9c9d8041e9366a9ffc75d5230490 SHA1 7f1c78854440fff2982dde51057055ba55772a2f SHA256 2af33956fc13949204f340aca6999a6adc999dcc1a9d3405b7c3503e2c95cf08 -AUX postgresql.conf-7.3 1515 RMD160 d2a5175d176bb1039a195c61762464769e86266a SHA1 7b33b242c5aa39bb56917b216aa7495c8cb3d100 SHA256 9e93fe9780bea82c9ef31f311cb556737aa940f749edf3d2a7f8dc36e12e93a4 -AUX postgresql.conf-7.4 1515 RMD160 6e5ffcdc845b13061a565021d09926f7fcf63c94 SHA1 ca6f8a32c6d91bc57336930b1f91feb5cd4c0fdb SHA256 9aeb9dae2e058804fd3e821b10cf620dc9cbd54cae94f8bc5eb34950badd4125 -AUX postgresql.conf-8.0 1515 RMD160 e866990bd42af8941f95bec7df1a325aff5f89b6 SHA1 ab7aee171705e3f74c93014d5519569fcc9a885e SHA256 68044a2a7e000691b2ed0995b3176c0b5507af1e9a395b24d104c16c66ad7d42 -AUX postgresql.conf-8.1 1515 RMD160 1eb23d12c69068de7208ca6647bd3da0a0bd3b1b SHA1 f0081d5522c8e71ea3ed9bce482ed80ad6327dd6 SHA256 f9a681e70beb5a1b07c97d82f6ed0c74985a1c6bd472b69d767e1144474ff3f6 -AUX postgresql.conf-8.2 1515 RMD160 75df0bf679f1e79c32914819151c597a5648210d SHA1 386615e01688f41970358eb8a9ae32449f4ed839 SHA256 a3d2cfa6d5c81db3657f35a61be35fbd7fbc2829274e138ac2644a495fd3ad82 -AUX postgresql.conf-8.3 1515 RMD160 bc3f75cfc9085b45daea522ce0d8c970c3c60ef5 SHA1 068af62cfc6ae21699d541152230ec0ac06d38e3 SHA256 ebbc5f2a5ed4c9911300d08b258677b3e8952fb784a68046a054f9bd04b74297 -AUX postgresql.init-7.3 1574 RMD160 96132dcb711eeff955cd675094ebaa498992c88e SHA1 6df2d666ce65082b5dbfa3acabdf31b7cd27cc97 SHA256 d9838db05996696fceab71b3027aac7d22ed951f20039d6cdfc5f5384ad5f103 -AUX postgresql.init-7.4 1574 RMD160 8823070010a54f029ec600504b1b27ddab0eebc2 SHA1 add78ddfa24cc95fae6e8247da5c2a485815368b SHA256 123005f0758a192d04709032f182688138063d07518728dba70fcfd02cf6595f -AUX postgresql.init-8.0 1574 RMD160 0af9e62cacc19a5879d76224b3d7b1c7f3fe6273 SHA1 975363339c257fc73f9b7d9d2a4148f882008754 SHA256 bfd8bce41e8e1ab14126e1eb337cc7096b49c058f3d0d28f81e2bb1c012ceefd -AUX postgresql.init-8.1 1574 RMD160 8766350e06793159ec45b7c0c7e77b1aa7312a06 SHA1 22ad2f0f70e58347c9e3ca46c539893b53598c0f SHA256 fde11ce4936f5b4cc40a7602f46833f8cf94bd73d0ff4b13028ea5c1c16deda4 -AUX postgresql.init-8.2 1574 RMD160 d498118cc84403ad6041bd0dba4819ab4792164d SHA1 549f1b20fab4dcf7185d88b2334519c6c8218b24 SHA256 0f2cbfb519a9f0c7fda4178fc2f74fb0e3409177e2fbbb159c493a070ff275ad -AUX postgresql.init-8.3 1574 RMD160 36441e4742f7b2af7178ac9b4e62cdf8c7f35446 SHA1 536a0fae273e595bff664abf67f01217f60ee4b7 SHA256 a584384a8e041668b3162be21da7894f16e35c07845122b31d6709b6dcdb4f2b +AUX postgresql.conf-7.3 1629 RMD160 74fdc71ec9f31cb396ff2dcb80c28818e3f308ab SHA1 0a60a38ab10bac2bceb56b755f3317cac93585c5 SHA256 1fe4c6bc37007bfa76bf03acc274c29dc026c64f099794487eddffa99374633c +AUX postgresql.conf-7.4 1629 RMD160 74fdc71ec9f31cb396ff2dcb80c28818e3f308ab SHA1 0a60a38ab10bac2bceb56b755f3317cac93585c5 SHA256 1fe4c6bc37007bfa76bf03acc274c29dc026c64f099794487eddffa99374633c +AUX postgresql.conf-8.0 1629 RMD160 74fdc71ec9f31cb396ff2dcb80c28818e3f308ab SHA1 0a60a38ab10bac2bceb56b755f3317cac93585c5 SHA256 1fe4c6bc37007bfa76bf03acc274c29dc026c64f099794487eddffa99374633c +AUX postgresql.conf-8.1 1629 RMD160 74fdc71ec9f31cb396ff2dcb80c28818e3f308ab SHA1 0a60a38ab10bac2bceb56b755f3317cac93585c5 SHA256 1fe4c6bc37007bfa76bf03acc274c29dc026c64f099794487eddffa99374633c +AUX postgresql.conf-8.2 1629 RMD160 e978b4f2c2a8945cf1a83e462eacd5c6f414d1c0 SHA1 32637027c593108c3b69b00fb23904c0b7b1678f SHA256 2038167ee01aa4c62b3b87223745783d7cc4760722645c71d8e6f1ecfc2b3a21 +AUX postgresql.conf-8.3 1629 RMD160 0eaaad116c4d7e514500101ec616eb6f5653ad26 SHA1 370f1a915d284b5b41813acc8d19bfdeec644ebf SHA256 6d1e3e01d9e50ad6d3b7aa3afa1c5b45e3722eab002e668bb6d5f1fa36782c75 +AUX postgresql.init-7.3 2155 RMD160 6878e838e8bca085a690afe475f7d804321ead01 SHA1 86bcacf81b9ac05e0e2527269fa998707673ed2e SHA256 78e7e2be5d2960cb43459c13b389642274eaeb1df79f8afb16e20d880acaefb8 +AUX postgresql.init-7.4 2155 RMD160 bc0a416070790a4a5cced9352b434ed2ecd97b0b SHA1 cd29ac99f9ca2fa28a347f83e2b02f1908145858 SHA256 d144d2522802132197c476f8512f496ced9aae6459775d6f2ca5884afbd6a222 +AUX postgresql.init-8.0 2155 RMD160 02ab6175a47e5d45ce8360e710b58eb9d82554e6 SHA1 af59f00792de35999fc68495822b94e86121371a SHA256 ca8602773dc390bc52aa8bac0c72d06b4c547de3b718d7e1428354760fd97dc8 +AUX postgresql.init-8.1 2155 RMD160 eabf8210804059a12bee06eab8c7364baed05fbe SHA1 3e825c815ee0da2b76aedd7d42451d608f2ac1d1 SHA256 afca498fd387b3848e4d1547792a7a0efe3f0201a4a6138a3a31ff8085cde1eb +AUX postgresql.init-8.2 2155 RMD160 b4301b4e8aaded7c38cca957a0320151d3be932b SHA1 36f03537749f0ec5ba5f5ffc3fc83f6bd926b25f SHA256 6b3b8cbe821d4d501e33dd0787f54e47d483019aed37c74f4b6370a1b47290c1 +AUX postgresql.init-8.3 2155 RMD160 c9a26142c6b36cff8b39a207d85e3eb55ed25dda SHA1 c1e0c97b5dce5c9f8073c2fbd3fe6ef4f43f41ba SHA256 d5d90fbedb68a76eddd6177624ceca016bbc16a52b3feef9affbea7f3ddabacc DIST postgresql-7.3.21.tar.bz2 9284558 RMD160 f9de4676b4fbe3d96e6d1462b8bc3c05600d6525 SHA1 bdfa3bddc483c6642cc2ee271d076bfaa4c20c92 SHA256 bf44e0ac259e9f6e14ac102f2977496b6996ecea2fd227fbdcea5fa70e342888 DIST postgresql-7.4.19.tar.bz2 10307396 RMD160 c9a1c7dc8e7bf9ce93c3b4f061af0563b1cc2627 SHA1 19c563d47b0d5deeef03b5ca7707c9f1917853ce SHA256 447ac7070aa0a547f17a307e842734fc27e2716cb4a251fa9a810b178d44c389 DIST postgresql-8.0.15.tar.bz2 11253897 RMD160 6aff5c63dce73eea609f0b6e013cd043ae8b7a37 SHA1 66a6fef7749afb91471200005511c04fc1ac2706 SHA256 59408a00db1c73e638a11af10438a827507b7a72b53916d58f2d44c477718714 @@ -38,5 +38,5 @@ EBUILD postgresql-server-8.0.15.ebuild 7967 RMD160 98623ab4e26874b90d2befec864f9 EBUILD postgresql-server-8.1.11.ebuild 8088 RMD160 c81b49aba166f90faf87b5ae278763cd09fe30e6 SHA1 2f2b0d475775ee412cc72703f9c7841b443abc03 SHA256 83172e0cf272926ca9715511a0ca00301e738b643c4d50ea66d6d46c418146e0 EBUILD postgresql-server-8.2.7.ebuild 8318 RMD160 e130264005bb0c8a0e17d8814e1de510b84908ad SHA1 a1519eebba917ca9b9e2b3e0ebfd2a2e3286f7a7 SHA256 fac930c548d777292622f6c0c663015eb15bcec9715bc31b62f37d9c540ffe5a EBUILD postgresql-server-8.3.1.ebuild 8405 RMD160 5464f4cef89fe6a3219b5ba32e814056d88283bc SHA1 a5d5047e6f1b44fd82a96d5a64e76c1f04f532ee SHA256 f82e485e5c095fcf9c12ad41eadad7d680260587b6e8f6cf7bd283fa2116febc -MISC ChangeLog 4047 RMD160 197cebd2759cb7e1aad162c80ec8d4c0621dcdfd SHA1 a330052b7228e5cb034ac35b34c8bb8497d81039 SHA256 caaa0792e3ac044cacf80a4638e400e47a8954b2effdee196eba4b4c73ec677e +MISC ChangeLog 4622 RMD160 dd183143956abfe6f2b0b7d894c0ca0a0ff2ec46 SHA1 a7ed6a964434133c7521bcf8f36517202097e902 SHA256 3d0b8cb39e5397c8ea84cf7209405ca85662eae95157faf8318b062e1c5496ab MISC metadata.xml 164 RMD160 becfe652663bd65719dd11fa6ffb588b3d5b4ecc SHA1 f67b7ac1c5e6e65ef5a19a589d4759c84918f86c SHA256 7e8e8126bc8701c4a42c7dfed8bb755ac6040fe3d0e3f994d888f8b2b4fa7d8b diff --git a/dev-db/postgresql-server/files/postgresql.conf-7.3 b/dev-db/postgresql-server/files/postgresql.conf-7.3 index 67b3105..e4b1c55 100644 --- a/dev-db/postgresql-server/files/postgresql.conf-7.3 +++ b/dev-db/postgresql-server/files/postgresql.conf-7.3 @@ -1,5 +1,5 @@ # PostgreSQL's Database Directory -PGDATA="/var/lib/postgresql/7.3/data" +PGDATA="/var/lib/postgresql/8.1/data" # PostgreSQL User PGUSER="postgres" @@ -31,10 +31,15 @@ PGGROUP="postgres" # This will terminate the server immediately and results in a recovery run for the next start. # Wait for clients to disconnect (seconds or "forever") -WAIT_FOR_DISCONNECT=10 +WAIT_FOR_DISCONNECT=30 # Time the server has to clean up (seconds or "forever") -WAIT_FOR_CLEANUP=10 +WAIT_FOR_CLEANUP=60 + +# Time the server has to quit (with a recover-run on next startup) +# Set to 0 to deactivate it +WAIT_FOR_QUIT=60 + # If you have to export environment variables for the database process, # this can be done here. diff --git a/dev-db/postgresql-server/files/postgresql.conf-7.4 b/dev-db/postgresql-server/files/postgresql.conf-7.4 index d5a2601..e4b1c55 100644 --- a/dev-db/postgresql-server/files/postgresql.conf-7.4 +++ b/dev-db/postgresql-server/files/postgresql.conf-7.4 @@ -1,5 +1,5 @@ # PostgreSQL's Database Directory -PGDATA="/var/lib/postgresql/7.4/data" +PGDATA="/var/lib/postgresql/8.1/data" # PostgreSQL User PGUSER="postgres" @@ -31,10 +31,15 @@ PGGROUP="postgres" # This will terminate the server immediately and results in a recovery run for the next start. # Wait for clients to disconnect (seconds or "forever") -WAIT_FOR_DISCONNECT=10 +WAIT_FOR_DISCONNECT=30 # Time the server has to clean up (seconds or "forever") -WAIT_FOR_CLEANUP=10 +WAIT_FOR_CLEANUP=60 + +# Time the server has to quit (with a recover-run on next startup) +# Set to 0 to deactivate it +WAIT_FOR_QUIT=60 + # If you have to export environment variables for the database process, # this can be done here. diff --git a/dev-db/postgresql-server/files/postgresql.conf-8.0 b/dev-db/postgresql-server/files/postgresql.conf-8.0 index 3a070b7..e4b1c55 100644 --- a/dev-db/postgresql-server/files/postgresql.conf-8.0 +++ b/dev-db/postgresql-server/files/postgresql.conf-8.0 @@ -1,5 +1,5 @@ # PostgreSQL's Database Directory -PGDATA="/var/lib/postgresql/8.0/data" +PGDATA="/var/lib/postgresql/8.1/data" # PostgreSQL User PGUSER="postgres" @@ -31,10 +31,15 @@ PGGROUP="postgres" # This will terminate the server immediately and results in a recovery run for the next start. # Wait for clients to disconnect (seconds or "forever") -WAIT_FOR_DISCONNECT=10 +WAIT_FOR_DISCONNECT=30 # Time the server has to clean up (seconds or "forever") -WAIT_FOR_CLEANUP=10 +WAIT_FOR_CLEANUP=60 + +# Time the server has to quit (with a recover-run on next startup) +# Set to 0 to deactivate it +WAIT_FOR_QUIT=60 + # If you have to export environment variables for the database process, # this can be done here. diff --git a/dev-db/postgresql-server/files/postgresql.conf-8.1 b/dev-db/postgresql-server/files/postgresql.conf-8.1 index 77c0b62..e4b1c55 100644 --- a/dev-db/postgresql-server/files/postgresql.conf-8.1 +++ b/dev-db/postgresql-server/files/postgresql.conf-8.1 @@ -31,10 +31,15 @@ PGGROUP="postgres" # This will terminate the server immediately and results in a recovery run for the next start. # Wait for clients to disconnect (seconds or "forever") -WAIT_FOR_DISCONNECT=10 +WAIT_FOR_DISCONNECT=30 # Time the server has to clean up (seconds or "forever") -WAIT_FOR_CLEANUP=10 +WAIT_FOR_CLEANUP=60 + +# Time the server has to quit (with a recover-run on next startup) +# Set to 0 to deactivate it +WAIT_FOR_QUIT=60 + # If you have to export environment variables for the database process, # this can be done here. diff --git a/dev-db/postgresql-server/files/postgresql.conf-8.2 b/dev-db/postgresql-server/files/postgresql.conf-8.2 index e712bf2..7c13834 100644 --- a/dev-db/postgresql-server/files/postgresql.conf-8.2 +++ b/dev-db/postgresql-server/files/postgresql.conf-8.2 @@ -31,10 +31,15 @@ PGGROUP="postgres" # This will terminate the server immediately and results in a recovery run for the next start. # Wait for clients to disconnect (seconds or "forever") -WAIT_FOR_DISCONNECT=10 +WAIT_FOR_DISCONNECT=30 # Time the server has to clean up (seconds or "forever") -WAIT_FOR_CLEANUP=10 +WAIT_FOR_CLEANUP=60 + +# Time the server has to quit (with a recover-run on next startup) +# Set to 0 to deactivate it +WAIT_FOR_QUIT=60 + # If you have to export environment variables for the database process, # this can be done here. diff --git a/dev-db/postgresql-server/files/postgresql.conf-8.3 b/dev-db/postgresql-server/files/postgresql.conf-8.3 index 6cc3210..b3447b4 100644 --- a/dev-db/postgresql-server/files/postgresql.conf-8.3 +++ b/dev-db/postgresql-server/files/postgresql.conf-8.3 @@ -31,10 +31,15 @@ PGGROUP="postgres" # This will terminate the server immediately and results in a recovery run for the next start. # Wait for clients to disconnect (seconds or "forever") -WAIT_FOR_DISCONNECT=10 +WAIT_FOR_DISCONNECT=30 # Time the server has to clean up (seconds or "forever") -WAIT_FOR_CLEANUP=10 +WAIT_FOR_CLEANUP=60 + +# Time the server has to quit (with a recover-run on next startup) +# Set to 0 to deactivate it +WAIT_FOR_QUIT=60 + # If you have to export environment variables for the database process, # this can be done here. diff --git a/dev-db/postgresql-server/files/postgresql.init-7.3 b/dev-db/postgresql-server/files/postgresql.init-7.3 index b8e013d..0b670cd 100644 --- a/dev-db/postgresql-server/files/postgresql.init-7.3 +++ b/dev-db/postgresql-server/files/postgresql.init-7.3 @@ -1,5 +1,5 @@ #!/sbin/runscript -# Copyright 1999-2007 Gentoo Foundation +# Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ @@ -31,25 +31,40 @@ start() { rm -f "$PGDATA/postmaster.pid" fi - start-stop-daemon --start \ - --pidfile "${PGDATA}/postmaster.pid" \ - --chuid ${PGUSER}:${PGGROUP} \ - --exec /usr/lib/postgresql-7.3/bin/postmaster \ - -- \ - -D "${PGDATA}" \ - --silent-mode=true \ - ${PGOPTS} + su -l ${PGUSER} \ + -c "env PGDATA=\"${PGDATA}\" /usr/lib/postgresql-7.3/bin/pg_ctl start -w -o '--silent-mode=true ${PGOPTS}'" eend $? } stop() { - ebegin "Stopping PostgreSQL" - # Note: we have to do --oknodo here, otherwise it will always fail - # when there are open transactions. This bug has been corrected - # in baselayout-1.13.0_alpha8. + ebegin "Stopping PostgreSQL (this can take up to $(( ${WAIT_FOR_DISCONNECT} + ${WAIT_FOR_CLEANUP} )) seconds)" + + start-stop-daemon --stop --pidfile "${PGDATA}/postmaster.pid" \ + --retry -TERM/${WAIT_FOR_DISCONNECT} + [ $? -eq 0 ] && eend $? && exit + + ewarn "Some clients did not disconnect within ${WAIT_FOR_DISCONNECT} seconds." + ewarn "Going to shutdown the server anyway." + + start-stop-daemon --stop --pidfile "${PGDATA}/postmaster.pid" \ + --retry -INT/${WAIT_FOR_CLEANUP} + [ $? -eq 0 ] && eend $? && exit + + if [ ${WAIT_FOR_QUIT} -eq 0 ] ; then + eerror "Server did not shut down and sending the SIGQUIT has been disabled." + eend $? + fi + + ewarn "Shutting down the server gracefully failed." + ewarn "Forcing it to shutdown which leads to a recover-run on next startup." + start-stop-daemon --stop --pidfile "${PGDATA}/postmaster.pid" \ - --retry -TERM/${WAIT_FOR_DISCONNECT}/-INT/${WAIT_FOR_CLEANUP}/-QUIT --oknodo + --retry -QUIT/${WAIT_FOR_QUIT} + + [ $? -eq 0 ] && eend $? && exit + + eerror "Forced shutdown failed!!! Something is wrong with your system, please take care of it manually." eend $? } diff --git a/dev-db/postgresql-server/files/postgresql.init-7.4 b/dev-db/postgresql-server/files/postgresql.init-7.4 index 29c948e..f2d9bd9 100644 --- a/dev-db/postgresql-server/files/postgresql.init-7.4 +++ b/dev-db/postgresql-server/files/postgresql.init-7.4 @@ -1,5 +1,5 @@ #!/sbin/runscript -# Copyright 1999-2007 Gentoo Foundation +# Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ @@ -31,25 +31,40 @@ start() { rm -f "$PGDATA/postmaster.pid" fi - start-stop-daemon --start \ - --pidfile "${PGDATA}/postmaster.pid" \ - --chuid ${PGUSER}:${PGGROUP} \ - --exec /usr/lib/postgresql-7.4/bin/postmaster \ - -- \ - -D "${PGDATA}" \ - --silent-mode=true \ - ${PGOPTS} + su -l ${PGUSER} \ + -c "env PGDATA=\"${PGDATA}\" /usr/lib/postgresql-7.4/bin/pg_ctl start -w -o '--silent-mode=true ${PGOPTS}'" eend $? } stop() { - ebegin "Stopping PostgreSQL" - # Note: we have to do --oknodo here, otherwise it will always fail - # when there are open transactions. This bug has been corrected - # in baselayout-1.13.0_alpha8. + ebegin "Stopping PostgreSQL (this can take up to $(( ${WAIT_FOR_DISCONNECT} + ${WAIT_FOR_CLEANUP} )) seconds)" + + start-stop-daemon --stop --pidfile "${PGDATA}/postmaster.pid" \ + --retry -TERM/${WAIT_FOR_DISCONNECT} + [ $? -eq 0 ] && eend $? && exit + + ewarn "Some clients did not disconnect within ${WAIT_FOR_DISCONNECT} seconds." + ewarn "Going to shutdown the server anyway." + + start-stop-daemon --stop --pidfile "${PGDATA}/postmaster.pid" \ + --retry -INT/${WAIT_FOR_CLEANUP} + [ $? -eq 0 ] && eend $? && exit + + if [ ${WAIT_FOR_QUIT} -eq 0 ] ; then + eerror "Server did not shut down and sending the SIGQUIT has been disabled." + eend $? + fi + + ewarn "Shutting down the server gracefully failed." + ewarn "Forcing it to shutdown which leads to a recover-run on next startup." + start-stop-daemon --stop --pidfile "${PGDATA}/postmaster.pid" \ - --retry -TERM/${WAIT_FOR_DISCONNECT}/-INT/${WAIT_FOR_CLEANUP}/-QUIT --oknodo + --retry -QUIT/${WAIT_FOR_QUIT} + + [ $? -eq 0 ] && eend $? && exit + + eerror "Forced shutdown failed!!! Something is wrong with your system, please take care of it manually." eend $? } diff --git a/dev-db/postgresql-server/files/postgresql.init-8.0 b/dev-db/postgresql-server/files/postgresql.init-8.0 index 067052a..ef9bbd1 100644 --- a/dev-db/postgresql-server/files/postgresql.init-8.0 +++ b/dev-db/postgresql-server/files/postgresql.init-8.0 @@ -1,5 +1,5 @@ #!/sbin/runscript -# Copyright 1999-2007 Gentoo Foundation +# Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ @@ -31,25 +31,40 @@ start() { rm -f "$PGDATA/postmaster.pid" fi - start-stop-daemon --start \ - --pidfile "${PGDATA}/postmaster.pid" \ - --chuid ${PGUSER}:${PGGROUP} \ - --exec /usr/lib/postgresql-8.0/bin/postmaster \ - -- \ - -D "${PGDATA}" \ - --silent-mode=true \ - ${PGOPTS} + su -l ${PGUSER} \ + -c "env PGDATA=\"${PGDATA}\" /usr/lib/postgresql-8.0/bin/pg_ctl start -w -o '--silent-mode=true ${PGOPTS}'" eend $? } stop() { - ebegin "Stopping PostgreSQL" - # Note: we have to do --oknodo here, otherwise it will always fail - # when there are open transactions. This bug has been corrected - # in baselayout-1.13.0_alpha8. + ebegin "Stopping PostgreSQL (this can take up to $(( ${WAIT_FOR_DISCONNECT} + ${WAIT_FOR_CLEANUP} )) seconds)" + + start-stop-daemon --stop --pidfile "${PGDATA}/postmaster.pid" \ + --retry -TERM/${WAIT_FOR_DISCONNECT} + [ $? -eq 0 ] && eend $? && exit + + ewarn "Some clients did not disconnect within ${WAIT_FOR_DISCONNECT} seconds." + ewarn "Going to shutdown the server anyway." + + start-stop-daemon --stop --pidfile "${PGDATA}/postmaster.pid" \ + --retry -INT/${WAIT_FOR_CLEANUP} + [ $? -eq 0 ] && eend $? && exit + + if [ ${WAIT_FOR_QUIT} -eq 0 ] ; then + eerror "Server did not shut down and sending the SIGQUIT has been disabled." + eend $? + fi + + ewarn "Shutting down the server gracefully failed." + ewarn "Forcing it to shutdown which leads to a recover-run on next startup." + start-stop-daemon --stop --pidfile "${PGDATA}/postmaster.pid" \ - --retry -TERM/${WAIT_FOR_DISCONNECT}/-INT/${WAIT_FOR_CLEANUP}/-QUIT --oknodo + --retry -QUIT/${WAIT_FOR_QUIT} + + [ $? -eq 0 ] && eend $? && exit + + eerror "Forced shutdown failed!!! Something is wrong with your system, please take care of it manually." eend $? } diff --git a/dev-db/postgresql-server/files/postgresql.init-8.1 b/dev-db/postgresql-server/files/postgresql.init-8.1 index 1fe2b66..183c4ba 100644 --- a/dev-db/postgresql-server/files/postgresql.init-8.1 +++ b/dev-db/postgresql-server/files/postgresql.init-8.1 @@ -1,5 +1,5 @@ #!/sbin/runscript -# Copyright 1999-2007 Gentoo Foundation +# Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ @@ -31,25 +31,40 @@ start() { rm -f "$PGDATA/postmaster.pid" fi - start-stop-daemon --start \ - --pidfile "${PGDATA}/postmaster.pid" \ - --chuid ${PGUSER}:${PGGROUP} \ - --exec /usr/lib/postgresql-8.1/bin/postmaster \ - -- \ - -D "${PGDATA}" \ - --silent-mode=true \ - ${PGOPTS} + su -l ${PGUSER} \ + -c "env PGDATA=\"${PGDATA}\" /usr/lib/postgresql-8.1/bin/pg_ctl start -w -o '--silent-mode=true ${PGOPTS}'" eend $? } stop() { - ebegin "Stopping PostgreSQL" - # Note: we have to do --oknodo here, otherwise it will always fail - # when there are open transactions. This bug has been corrected - # in baselayout-1.13.0_alpha8. + ebegin "Stopping PostgreSQL (this can take up to $(( ${WAIT_FOR_DISCONNECT} + ${WAIT_FOR_CLEANUP} )) seconds)" + + start-stop-daemon --stop --pidfile "${PGDATA}/postmaster.pid" \ + --retry -TERM/${WAIT_FOR_DISCONNECT} + [ $? -eq 0 ] && eend $? && exit + + ewarn "Some clients did not disconnect within ${WAIT_FOR_DISCONNECT} seconds." + ewarn "Going to shutdown the server anyway." + + start-stop-daemon --stop --pidfile "${PGDATA}/postmaster.pid" \ + --retry -INT/${WAIT_FOR_CLEANUP} + [ $? -eq 0 ] && eend $? && exit + + if [ ${WAIT_FOR_QUIT} -eq 0 ] ; then + eerror "Server did not shut down and sending the SIGQUIT has been disabled." + eend $? + fi + + ewarn "Shutting down the server gracefully failed." + ewarn "Forcing it to shutdown which leads to a recover-run on next startup." + start-stop-daemon --stop --pidfile "${PGDATA}/postmaster.pid" \ - --retry -TERM/${WAIT_FOR_DISCONNECT}/-INT/${WAIT_FOR_CLEANUP}/-QUIT --oknodo + --retry -QUIT/${WAIT_FOR_QUIT} + + [ $? -eq 0 ] && eend $? && exit + + eerror "Forced shutdown failed!!! Something is wrong with your system, please take care of it manually." eend $? } diff --git a/dev-db/postgresql-server/files/postgresql.init-8.2 b/dev-db/postgresql-server/files/postgresql.init-8.2 index ef06024..255f0d6 100644 --- a/dev-db/postgresql-server/files/postgresql.init-8.2 +++ b/dev-db/postgresql-server/files/postgresql.init-8.2 @@ -1,5 +1,5 @@ #!/sbin/runscript -# Copyright 1999-2007 Gentoo Foundation +# Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ @@ -31,25 +31,40 @@ start() { rm -f "$PGDATA/postmaster.pid" fi - start-stop-daemon --start \ - --pidfile "${PGDATA}/postmaster.pid" \ - --chuid ${PGUSER}:${PGGROUP} \ - --exec /usr/lib/postgresql-8.2/bin/postmaster \ - -- \ - -D "${PGDATA}" \ - --silent-mode=true \ - ${PGOPTS} + su -l ${PGUSER} \ + -c "env PGDATA=\"${PGDATA}\" /usr/lib/postgresql-8.2/bin/pg_ctl start -w -o '--silent-mode=true ${PGOPTS}'" eend $? } stop() { - ebegin "Stopping PostgreSQL" - # Note: we have to do --oknodo here, otherwise it will always fail - # when there are open transactions. This bug has been corrected - # in baselayout-1.13.0_alpha8. + ebegin "Stopping PostgreSQL (this can take up to $(( ${WAIT_FOR_DISCONNECT} + ${WAIT_FOR_CLEANUP} )) seconds)" + + start-stop-daemon --stop --pidfile "${PGDATA}/postmaster.pid" \ + --retry -TERM/${WAIT_FOR_DISCONNECT} + [ $? -eq 0 ] && eend $? && exit + + ewarn "Some clients did not disconnect within ${WAIT_FOR_DISCONNECT} seconds." + ewarn "Going to shutdown the server anyway." + + start-stop-daemon --stop --pidfile "${PGDATA}/postmaster.pid" \ + --retry -INT/${WAIT_FOR_CLEANUP} + [ $? -eq 0 ] && eend $? && exit + + if [ ${WAIT_FOR_QUIT} -eq 0 ] ; then + eerror "Server did not shut down and sending the SIGQUIT has been disabled." + eend $? + fi + + ewarn "Shutting down the server gracefully failed." + ewarn "Forcing it to shutdown which leads to a recover-run on next startup." + start-stop-daemon --stop --pidfile "${PGDATA}/postmaster.pid" \ - --retry -TERM/${WAIT_FOR_DISCONNECT}/-INT/${WAIT_FOR_CLEANUP}/-QUIT --oknodo + --retry -QUIT/${WAIT_FOR_QUIT} + + [ $? -eq 0 ] && eend $? && exit + + eerror "Forced shutdown failed!!! Something is wrong with your system, please take care of it manually." eend $? } diff --git a/dev-db/postgresql-server/files/postgresql.init-8.3 b/dev-db/postgresql-server/files/postgresql.init-8.3 index f2a90ef..be8044b 100644 --- a/dev-db/postgresql-server/files/postgresql.init-8.3 +++ b/dev-db/postgresql-server/files/postgresql.init-8.3 @@ -1,5 +1,5 @@ #!/sbin/runscript -# Copyright 1999-2007 Gentoo Foundation +# Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ @@ -31,25 +31,40 @@ start() { rm -f "$PGDATA/postmaster.pid" fi - start-stop-daemon --start \ - --pidfile "${PGDATA}/postmaster.pid" \ - --chuid ${PGUSER}:${PGGROUP} \ - --exec /usr/lib/postgresql-8.3/bin/postmaster \ - -- \ - -D "${PGDATA}" \ - --silent-mode=true \ - ${PGOPTS} + su -l ${PGUSER} \ + -c "env PGDATA=\"${PGDATA}\" /usr/lib/postgresql-8.3/bin/pg_ctl start -w -o '--silent-mode=true ${PGOPTS}'" eend $? } stop() { - ebegin "Stopping PostgreSQL" - # Note: we have to do --oknodo here, otherwise it will always fail - # when there are open transactions. This bug has been corrected - # in baselayout-1.13.0_alpha8. + ebegin "Stopping PostgreSQL (this can take up to $(( ${WAIT_FOR_DISCONNECT} + ${WAIT_FOR_CLEANUP} )) seconds)" + + start-stop-daemon --stop --pidfile "${PGDATA}/postmaster.pid" \ + --retry -TERM/${WAIT_FOR_DISCONNECT} + [ $? -eq 0 ] && eend $? && exit + + ewarn "Some clients did not disconnect within ${WAIT_FOR_DISCONNECT} seconds." + ewarn "Going to shutdown the server anyway." + + start-stop-daemon --stop --pidfile "${PGDATA}/postmaster.pid" \ + --retry -INT/${WAIT_FOR_CLEANUP} + [ $? -eq 0 ] && eend $? && exit + + if [ ${WAIT_FOR_QUIT} -eq 0 ] ; then + eerror "Server did not shut down and sending the SIGQUIT has been disabled." + eend $? + fi + + ewarn "Shutting down the server gracefully failed." + ewarn "Forcing it to shutdown which leads to a recover-run on next startup." + start-stop-daemon --stop --pidfile "${PGDATA}/postmaster.pid" \ - --retry -TERM/${WAIT_FOR_DISCONNECT}/-INT/${WAIT_FOR_CLEANUP}/-QUIT --oknodo + --retry -QUIT/${WAIT_FOR_QUIT} + + [ $? -eq 0 ] && eend $? && exit + + eerror "Forced shutdown failed!!! Something is wrong with your system, please take care of it manually." eend $? } -- cgit v1.2.3-65-gdbad