Linux note: How to start an application automatically on boot

  • Modify /etc/rc.d/rc.local file

If you wish to add a new service to start when the machine boots you should add the necessary script to the directory /etc/init.d/. Many of the scripts already present in that directory will give you an example of the kind of things that you can do.

  • Newer versions of linux support systemd.  It has more features and is more portable than debian-specific solution.

sample script:

[Unit]
Description=Example systemd service.

[Service]
Type=simple
ExecStart=/bin/bash /path/to/myscript.sh

[Install]
WantedBy=multi-user.target
  • Using crontab
$ crontab -e

@reboot /home/nick/auto_run_script.sh