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:
Manage services [start,stop,reload,etc]:
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:
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:
...which produces a clean and simple ncurses GUI which allows to manage service startup and edit runlevels: