How to run script on startup on Ubuntu 20.04 Focal Fossa Server/Desktop -

In this article you will learn how to run script ( python, bash etc. ) on startup on Ubuntu 20.04 Server/Desktop
This is a companion discussion topic for the original entry at

I believe that you are missing an important instruction in Step 1:

First, create a Systemd service file as in an example below:



After: Instructs systemd on when the script should be run. In our case the script will run after network connection. Other example could be etc.
ExecStart: This field provides a full path to the actual script to be executed on startup
WantedBy: Into what boot target the systemd unit should be installed
For more information on how to create Systemd service unit execute the man systemd.unit command.

Namely, you should mention that when you create the example service it should be saved as a file, e.g., disk-space-check.service in /etc/systemd/system/.

While a close read of step 3 explains that, a novice might not understand what file to create where.

THANK you!

Otherwise you need to scroll to the bottom of the article, see where the file is, then scroll back up to get the contents…