How to use systemd to run a startup script on boot

This example shows how to start a script when multi-user is launched. Create a new file in /etc/systemd/system [e.g. myscript.service] and add the following content: [Unit] Description=My Script [Service] ExecStart=/usr/bin/my-script [Install] WantedBy=multi-user.target Put your script in /usr/bin/my-script and make sure it’s executable. sudo chmod 755 /usr/bin/my-script Then enable the service: sudo systemctl enable myscript.service