2

In RedHat/CentOS distros, you start and stop services with /sbin/service:

/sbin/service httpd reload

You set whether they should run on startup with /sbin/chkconfig:

/sbin/chkconfig --levels 2345 on

What are the equivalents for a Debian-based distro like Ubuntu?

3 Answers 3

4

On Debian and Ubuntu you can run /etc/init.d scripts directly, as used to be true also on Red Hat / Centos, or use invoke-rc.d or service. I think the upstart stuff is still evolving, so this may change.

# /etc/init.d/httpd reload
# /usr/bin/service httpd reload
# /usr/sbin/invoke-rc.d httpd reload

update-rc.d is the tool corresponding to chkconfig.

# /usr/sbin/update-rc.d httpd start 20 2 3 4 5 . 80 0 1 6 .

But insserv is becoming the standard way to do this:

 # /sbin/insserv httpd,start=2,3,4,5 # 0,1,6 will be automatically set to off
1
  • You still can run init.d scripts directly in RedHat/Centos.
    – JeffG
    Mar 10, 2011 at 3:13
3

Services can be started/stopped in Ubuntu with /usr/sbin/service serviceName start|stop. The syntax is the same as RH/Cent, but the path is different. Upstart isn't currently used in Debian, so use /etc/init.d/service serviceName start|stop instead.

/usr/sbin/update-rc.d is what I use to enable/disable services at startup. Check out the manpage for more details.

0

In Ubuntu releases which use upstart, many services don't have /etc/init.d scripts. The utility to use in this case is initctl

Here's a link describing it and Upstart in general.

http://upstart.ubuntu.com/cookbook/#utilities

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .