Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want to stop some daemons from loading at boot time, specially squid3. What is the best way of doing this?

share|improve this question
    
+1 perfectly phrased for someone searching for the answer to this question. –  msw Jan 26 '11 at 2:43

3 Answers 3

up vote 6 down vote accepted

You can use chkconfiginstall chkconfig utility for this purpose.

sudo apt-get install chkconfig

To check the run level status of squid you can run this command:

 chkconfig --list | grep squid

This will output something like below:

squid           0:off   1:off   2:on    3:on    4:on    5:on    6:off

To turn off squid in all run level you can use this command:

sudo chkconfig  squid off

 chkconfig --list | grep squid

squid           0:off   1:off   2:off   3:off   4:off   5:off   6:off

To turn off squid in a particular run level you can use this command:

 chkconfig  --level 3  squid off
share|improve this answer
    
We have 7 leveles from (0 - 6).What are those levels?Can you explain us? –  karthick87 Dec 2 '10 at 12:51
    
@karthik87:Here is a nice article about linux run levels. This will help you : comptechdoc.org/os/linux/howlinuxworks/linux_hlrunlevels.html –  aneeshep Dec 2 '10 at 13:12
    
+1 complete, canonical, authoritative –  msw Jan 26 '11 at 2:44
    
What about upstart scripts? –  Javier Rivera Jan 26 '11 at 9:51

System daemons can use either legacy SysV init scripts or the newer Upstart.

For sysv scripts there are several management tools, one of such tools is "sysv-rc-conf" from the "sysv-rc-conf" package, install it and launch it from the terminal.

Regarding Upstart as far as I know there is no management tool yet, you need to manually rename the corresponding script from /etc/init, eg:

mv /etc/init/ufw.conf /etc/init/ufw.conf.disabled

Squid3 uses sysv init scripts, you can disable it with sysv-rc-conf .

share|improve this answer
1  
Addendum: When moving your upstart job away, you cannot manually start it anymore. It's probably better to just uncomment the "start on" part in the .conf file. –  htorque Dec 2 '10 at 9:12

Squid uses the old init system, so this command should do the trick: sudo update-rc.d -f squid3 remove.

For more find-grained control of when to start/stop the service: sudo sysv-rc-conf

share|improve this answer
    
Ad 1.: that will also remove the links to stop the service, which is probably not what you want in case you started it manually. –  htorque Dec 2 '10 at 9:13
    
That's wrong, you can always start/stop it with /etc/init.d/squid3 start or stop. –  evgeny Dec 2 '10 at 9:23
    
It will remove the K*-links that stop the service automatically. ;) –  htorque Dec 2 '10 at 9:53
    
Who would want that anyway? ;) –  evgeny Dec 2 '10 at 10:24
    
The lazy people (ME)! :-P –  htorque Dec 2 '10 at 11:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.