Run application at startup in Ubuntu

Below is an example of creating a script to autorun the desired program.

Create a script:

sudo touch /etc/init.d/name

Open it in a text editor (in the editor nano Ctrl+X to exit, and y/n to save or cancel changes):

sudo nano /etc/init.d/name

Fill it with content like:

#!/bin/bash
/etc/init.d/programma start

Let’s make the script executable:

sudo chmod +x /etc/init.d/name

Add the script to startup:

sudo update-rc.d name defaults 95

You can get the documentation for update-rc.d by running the command:

man update-rc.d

To remove a script from autorun, use the command:

sudo update-rc.d name remove

See also:
Solving the error “insserv: warning: script ‘script’ missing LSB tags and overrides”

Leave a comment

Leave a Reply

Discover more from IT Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading