autostart_on_debian

Autostart on Debian

to autostart a service that has an init.d script use update-rc.d:

update-rc.d serviceName default

this will create S20serviceName symlinks in the rcX.d directories for runlevels 2345 and stop scripts in other runlevels

to remove a service, it is not advisable to simply delete the symlinks. the problem is, that if a service is updated through apt for example, it will probably run its post install script again which will run update-rc.d again and hence autostart it again on the system making it necessary to remove the links once again. The proper way is, to set the service to Stop on all start-runlevels after removing the symlinks:

update-rc.d -f serviceName remove
udpate-rc.d serviceName stop 20 2 3 4 5

this will prevent an updater from autostarting the service upon next boot.

to change the autostart state of a service, run

update-rc.d -f serviceName remove

first because update-rc.d will not change existing symlinks, so if for example a service is marked to stop on all runlevels and you run update-rc.d with the defaults option it won't do anything, only after deleting the symlinks in those rcX.d directories where you want to change the startup state it will re-create the link with the new state.

  • autostart_on_debian.txt
  • Last modified: 10.03.2015 12:00
  • by Pascal Suter