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:
- 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:
- nano /etc/rc.local
- sh /location to your script/script.sh
- chmod +x /etc/rc.local
- nano /etc/rc.local
- Using crontab -e , add this line:
@reboot ( sleep 30 ; sh /location to your script/script.sh )