In this post, I will introduce three ways to create a startup script in Ubuntu: systemd (systemctl command), crontab (@reboot directive), shell startup script (.bash_login, .bashrc, ...).

Assume that the script to be ran when startup is at /home/transang/startup.sh.

Create systemd startup script

Add startup crontab job

Create shell startup script

Source