Linux: systemd removing IPC resources of PostgreSQL or Oracle (RemoveIPC)
Disable RemoveIPC in logind.conf so systemd does not delete a database service's shared memory.
On Linux distributions using systemd (RHEL/CentOS 7 and later, Debian...), systemd-logind can remove a user's System V IPC resources (shared memory, semaphores) when that user's last session ends. This can bring down a service run by a non-system user, typically PostgreSQL or Oracle.
Check the setting
cat /etc/systemd/logind.conf | grep RemoveIPC
If the value is RemoveIPC=yes, the user's IPC objects are removed at logout.
Fix
In /etc/systemd/logind.conf, set:
RemoveIPC=no
then restart the service:
systemctl restart systemd-logind