HOW TO : Manage startup services in Ubuntu

Most Redhat/Fedora users are used to chkconfig and service for controlling the services/programs that startup at boot time. Here is how you do it in Ubuntu

  • Check status of a particular service

[bash] sudo SERVICE_NAME status [/bash]

Example : Check the status of Apache Web Service

[bash]samurai@samurai:~$ sudo service apache2 status
Apache is running (pid 3496).[/bash]

  • Add a service to start on bootup

[bash] update-rc.d SERVICE_NAME add [/bash]

Example : Configure squid to start on bootup

[bash] update-rc.d squid add [/bash]

  • Stop a service from starting on bootup

[bash] update-rc.d SERVICE_NAME remove [/bash]

Example : Configure squid to NOT start on bootup

[bash] update-rc.d squid remove [/bash]

NOTE : You need to have a startup script in /etc/init.d for the service to ensure update-rc.d works fine.