-
-
Save rduplain/4946399 to your computer and use it in GitHub Desktop.
#!/bin/sh | |
# /usr/sbin/policy-rc.d | |
# Do not stop/restart postgresql. --rduplain 2013-02-13 | |
# http://askubuntu.com/a/254307/113086 | |
if [ "$1" = "postgresql" ]; then | |
# Forbid stop/restart, or any init action for that matter. | |
# 101 - action forbidden by policy | |
exit 101 | |
fi |
@polobo:
for first part of your question: there is second argument "action", you can add second check, so 101 is returned only for "stop" and "restart", while "start" and "reload" will continue to work, so you can keep policy on server forever.
Second and third questions are more tricky:
http://www.postgresql.org/docs/devel/static/upgrading.html states: To update between compatible versions, you simply replace the executables while the server is down and restart the server. The data directory remains unchanged — minor upgrades are that simple.
so currently upgrade routine follows documentation (keeping data safe). Maybe in future, there will be "better" upgrade procedure, doing something similar to nginx (http://nginx.org/en/docs/control.html#upgrade), which probably will be issue with memory / resident set / caches.
So what happens if you forget to remove policy-rc.d and the server reboots? Does the PostgreSQL fail to come back up?
Is there any issue (does it happen and does it matter) if the upgrade replaces files underneath a running server.
Why doesn't the upgrade routine handle this itself already?