Here’s general documentation on how to create a systemd service: Basic Linux Commands | Toradex Developer Center
After that here’s how to capture the changes and produce a TorizonCore image that has your changes: Capturing Changes in the Configuration of a Board on TorizonCore | Toradex Developer Center
Please note that everything should be in /etc
in the filesystem for it to be captured properly. This includes the script that your systemd service will call.
Best Regards,
Jeremias