Managing services in Debian
I'm used to System V style commands used in Red Hat / Fedora and derivatives as well as SUSE, so I found Debian service management methods unintuitive at first.
Below are a couple of personal notes I made on the subject to help myself out, as I was getting used to the Debian way of things...
List existing services:
ls /etc/rc2.d/S*
Manage services (start
, stop
, reload
, etc):
/etc/init.d/service command
Make service start on boot:
update-rc.d name defaults
The defaults
value makes the service start in runlevels 0123
and stop in 456
. Alternatively, you can specify which runlevels the service will start and stop in with:
update-rc.d name start runlevel stop runlevel
To remove service from starting on boot:
update-rc.d name remove
BTW, for a really excellent breakdown of update-rc.d
options, check out this well written post.
If you install sysvconfig (apt-get install sysvconfig
) you can also use System V style commands to start/stop services:
service name command
Unfortunately, even having installed sysvconfig in Debian, the command to list all services with status (e.g. running, unused, etc) is still missing. In SUSE, you'd run it with:
service -s
And would get a nice little list like this:
In the absence of the above, you could just list running processes with ps
. Another option is to list files in /var/run
whose filename ends with pid
, as each of those corresponds to a service:
find . /var/run | grep pid
Yet another option, with sysvconfig installed on Debian, is to just run:
sysvconfig
...which produces a clean and simple ncurses GUI which allows to manage service startup and edit runlevels:
1 Comment
1. gorn replies at 20th December 2014, 11:31 pm :
In modern day Debian you can now do
to get status of all services.
Leave a comment