Proper and clean way to write startup script

Hi

Thanks for PatchBox OS, I just started with it and it improved alls cracks and reduce the latency, and improve syncro ( like ableton sync on rpi ) also between software … that’s amazing.

I would like to know the proper , and clean way to startup script at boot. Actually I decided to create a “service” trough systemctl to start my program on boot. But , I had no sound, and I concluded that jack service was not started before my service.

Of course I get sound when I launch the script manually.

Thanks

Hi, could you show us what .service file you had? Most likely, it’s just missing a couple of lines.

For your service to start after jack, you should have this within [Unit]:

Requires=jack.service

It also must have the correct environment imported for the service to be able to interact with the Jack server, as all services by default have empty environment. You have to have these lines within [Service]:

[Service]
EnvironmentFile=/etc/environment
Environment=HOME=/root

Environment=HOME=/root may not be necessary in your case, or your service may be running as a different user, so adjust accordingly.