Ubuntu 20.04: execute script at startup

Install screen.

sudo apt install screen

Open in edit mode the rc.local file:

sudo nano /etc/rc.local

Add the script that you want execute at startup. Remember to change SESSION_NAME with what your want and /home/test/myScript.sh with you script path.

screen -dmS SESSION_NAME bash -c '/home/test/myScript.sh; exec bash';

To check your script execution you can resume the screen session by executing the following command:

screen -r SESSION_NAME

Use the key sequence Ctrl-a + Ctrl-d to detach from the screen session.