A systemd service to activate postgresql only when you need it
requires: Postgresql and Systemd
- create
postgresql.socketinto/usr/lib/systemd/system - run
sudo systemctl enable postgresql.socketto enable the socket service - Optional run
sudo systemctl start postgresql.socketto use it this boot
- run
sudo systemctl disable postgresql.socketto disable the socket service - run
sudo systemctl stop postgresql.socketto stop the listening socket
- slow 1st time usage, may even fail 1st connection attempt
ListenStreamneeds to point to where postgres would be, e.g. port5432or a socket file. Config is for Arch Linux