Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a daemon that runs fin if I start it manually with the service command:

ricardo@ricardo-laptop:~$ sudo service minidlna start
 * Starting minidlna minidlna                                            [ OK ] 

but it's not configured to auto start when the PC reboots.

How can I configure it to start automatically, even if no one is logged into the PC?

share|improve this question
@user154721 What arguments did you give update-rc.d to make autostart work? I've tried various options but haven't had any luck. – BennyTheBen Aug 13 '13 at 10:41
up vote 157 down vote accepted
sudo update-rc.d minidlna defaults

This should add the service to the automatic startup system. But if you get:

System start/stop links for /etc/init.d/minidlna already exist.

Do the command

sudo update-rc.d minidlna enable

P.S.: For further detail look at the man page for update-rc.d by typing the command man update-rc.d

share|improve this answer
thanks, but what if I get this output when running that command?: System start/stop links for /etc/init.d/minidlna already exist. – Ricardo Reyes Oct 25 '10 at 16:02
I grep'd for minidlna in all the files at /var/log and couldn't find any mention of the service at startup – Ricardo Reyes Oct 25 '10 at 16:03
if minidlna doesnt write to any logfile you won't find it any where. Does it maybe fail because there is no network connection when it is started? Try to look at the configuration if it is possible turn on debugging and/or logging to find out whats wrong. – LassePoulsen Oct 25 '10 at 16:20
@RicardoReyes use sudo update-rc.d -f minidlna remove to remove the existing links. – Dogweather Jun 9 '14 at 6:04
I am getting below error update-rc.d: /etc/init.d/usermanage: file does not exist – Rizwan Patel Mar 14 at 8:17

Sometimes you need to run a script on boot process, for example run an iptables config at boot process. So you don’t have to run the script manually every rebooting.

You can run your script on boot process in Ubuntu by adding it to /etc/init.d/rc.local file. Look the steps below.

  1. Open /etc/rc.local file with this command:

    vim /etc/rc.local
  2. Add your script that you want to run on boot process there, for example:

    sh /home/ivan/ 
    echo 'Iptable Configured!'
  3. Review the comments included in that file and make sure an exit 0 is at the end.

  4. Save the files. And your script will run on boot process.

share|improve this answer
Comments of /etc/init.d/rc.local in Ubuntu 12.04 says "Short-Description: Run /etc/rc.local if it exist", so maybe adding the scripts to /etc/rc.local would be better idea? – Hugh Lee Apr 11 '13 at 5:29
Would this method issue "shutdown" command to the service or just kill the process upon OS shutdown? – Vadim Chekan Jul 25 '14 at 0:25
Vadim, rc.local is just run at boot, nothing is achieved on shutdown. The process would most likely be killed by the OS on shutdown. – Weboide Dec 4 '14 at 12:45
  • To start a daemon at startup:

    update-rc.d service_name defaults
  • To remove:

    update-rc.d -f service_name remove

defaults => default run levels 2,3,4 and 5


update-rc.d tomcat7 defaults
share|improve this answer
When I do this command, I get "System start/stop links for /etc/init.d/tomcat7 already exist". however, when I reboot, it does not start tomcat, I always have to do "service tomcat7 start". – John Little Feb 8 at 15:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.