I have a daemon that runs fine 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?
This should add the service to the automatic startup system. But if you get:
Do the command
P.S.: For further detail look at the man page for update-rc.d by typing the command
man update-rc.d
To start a daemon at startup:
To remove:
defaults => default run levels 2,3,4 and 5
Example:
Since Ubuntu 15.10 and newer (resp. Debian 8 "jessie" and newer), you have to use the following command to configure your service
minidlna
to run at startup:And to disable it again from starting at boot time:
This works with all service names available on your system. To find out available service names, just list the filenames of the service files:
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.Open
/etc/rc.local
file with this command:Add your script that you want to run on boot process there, for example:
Review the comments included in that file and make sure an exit 0 is at the end.
Save the files. And your script will run on boot process.
In ubuntu version 18.04 TLS, I found that update-rc.d does not work fine if there is no specific comment block in the start script that looks like this: