Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

When you install Alfresco, it gives you an option of having it installed as a service or not.

If you install it as a service, the service starts up on booting but since it's using Tomcat it's too heavy to leave as a background program. In addition, it takes a lot longer to stop than Apache.

Therefore, I would like to keep it as a service but have it set to off by default so all I need to do is type sudo service alfresco start.

While I can leave it set-up not as a service and write a bash script or two, I'd like to learn more about how "services" work in Linux. Apache's not a problem but it would be nice to know where its service parameters are stored and how you can change these.

share|improve this question
add comment

3 Answers

up vote 3 down vote accepted

The 'general' approach would be

$ sudo update-rc.d -f servicename remove

to remove the servicename from any runlevel to start automatically.

To re-enable the defaults, do

$ sudo update-rc.d servicename defaults
share|improve this answer
    
That worked. Thank you. –  Simon Hoare Nov 21 '12 at 9:28
add comment

By default, Debian ships with SysVinit. Which services are executed in which runlevels is controlled through symbolic links in /etc/initN.d (N = 0 to 6, with 2–5 being the normal runlevels; S is for services started at boot time). See Dmitry Vasilyanov and gertvdijk's answers for ways of configuring these symbolic links.

I like to use the file-rc package, which replaces the symbolic links with a simple text file /etc/runlevel.conf.

If you're going to turn off a lot of services, or if you want to prevent a service from starting when it's installed or upgraded (a known issue on Debian), you can define a local service start policy. Write a script called /usr/sbin/policy-rc.d that implements the init script policy of your choice. See /usr/share/doc/sysv-rc/README.policy-rc.d on your system for details. Implementing a full policy is a bit of work, but you can make simple cases work; for example, if the script just contains exit 101, then no init script will ever be executed (this is convenient for systems installed in a chroot).

share|improve this answer
add comment

You could use sysv-rc-conf to manage runlevels (configure which services are supposed to be started at which runlevels).

It is quite simple:

  1. Install it: sudo apt-get install sysv-rc-conf
  2. Run it: sudo sysv-rc-conf
  3. Mark your service to be started on desired runlevels (2, 3, 4 and 5 are regular boot, 0 is shutdown, 6 is reboot). Use keyboard arrows to navigate and space key to toggle a checkbox.
share|improve this answer
    
Thanks. Will look into that. –  Simon Hoare Nov 20 '12 at 14:32
add comment

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.