Ubuntu: How to stop postgres from autostarting during start up


I have postgresql 8.4 installed on my desktop. It keeps starting on bootup because I think I used default settings.

so I issue /etc/init.d/postgresql stop everytime and sometimes i keep forgetting

It has folder paths as,

/etc/postgresql/8.4/main  /usr/lib/postgresql/8.4  

There are a lot of configuration files and if someone can tell me where to look and what to change, that will be great.



This can help you: http://www.linuxquestions.org/questions/linux-general-1/how-to-remove-postgresql-from-startup-481963/#post2417585

But install chkconfig first:

sudo apt-get install chkconfig  

and then use it



Using update-rc.d (Debian/Ubuntu):

janus@Zeus:~$ sudo update-rc.d -f postgresql remove   Removing any system startup links for /etc/init.d/postgresql ...     /etc/rc0.d/K21postgresql     /etc/rc1.d/K21postgresql     /etc/rc2.d/S19postgresql     /etc/rc3.d/S19postgresql     /etc/rc4.d/S19postgresql     /etc/rc5.d/S19postgresql     /etc/rc6.d/K21postgresql  janus@Zeus:~$  

On Ubuntu 16.04 or later (which use systemd) you'd use this command

sudo systemctl disable postgresql  

If you want to re-enable, you'd do

sudo systemctl enable postgresql  


Using update-rc.d is better but you can do it with chkconfig:

sudo apt-get install chkconfig  sudo chkconfig -s  postgresql off  

In Ubuntu 12.04, you also need to create a symlink to insserv's location:

sudo ln -s /usr/lib/insserv/insserv /sbin/insserv  


The answers in here are outdated. Take a look at this answer.



On my server there is another effect:

  # update-rc.d -f postgresql remove  update-rc.d: using dependency based boot sequencing  

No system startup links were removed.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »