Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

2 Answers 2

up vote 54 down vote accepted
sudo update-rc.d minidlna defaults

This should add the service to the automatic startup system. For further detail look at the man page for update-rc.d by typing the command man update-rc.d

share|improve this answer
3  
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. –  Source Lab Oct 25 '10 at 16:20
1  
@RicardoReyes use sudo update-rc.d -f minidlna remove to remove the existing links. –  Dogweather Jun 9 at 6:04

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

  1. Add your script that you want to run on boot process there, for example:

sh /home/ivan/iptables.sh echo 'Iptable Configured!'

  1. Review the comments included in that file and make sure a exit 0 is at the end.

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

share|improve this answer
1  
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? –  Sangdol 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 at 0:25

Your Answer

 
discard

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.