There will come a time when you need to start some scripts at startup, but you don’t want to to create it as a service. This is to help you to accomplish that.

There are 2 methods:

  1. Using /etc/rc.local , this seems only working on Ubuntu 18.04 and older , from version 19, it seems not working. It’s like a bat file in windows, you create that file if it does not exist:
    1. nano /etc/rc.local
      1. sh /location to your script/script.sh
    2. chmod +x /etc/rc.local
  2. Using crontab -e , add this line:
     
@reboot ( sleep 30 ; sh /location to your script/script.sh )