Skip to content

Instantly share code, notes, and snippets.

Last active Dec 13, 2015
What would you like to do?
Prevent stop/restart of postgresql on Debian/Ubuntu. Do so carefully while watching updates, and restart manually.
# /usr/sbin/policy-rc.d
# Do not stop/restart postgresql. --rduplain 2013-02-13
if [ "$1" = "postgresql" ]; then
# Forbid stop/restart, or any init action for that matter.
# 101 - action forbidden by policy
exit 101

This comment has been minimized.

Copy link

@polobo polobo commented Feb 18, 2015

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?


This comment has been minimized.

Copy link

@webervin webervin commented May 1, 2015

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: 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 (, which probably will be issue with memory / resident set / caches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment