Question: How to stop Postgresql when you have multiple versions of PGSQL Running on Ubuntu
You may run the following command to stop specific version of postgresql when using multiple versions of postgresql in a single system, under Ubuntu
systemctl stop postgresql[@version-main]
So, for example, if you have a system, with 3 postgresql server, 12, 14, 15, and would like to stop 14 and 15, then you can run the following:
systemctl stop postgresql@15-main systemctl stop postgresql@14-main
To disable them from booting:
systemctl disable postgresql@15-main systemctl disable postgresql@14-main