How to change serial baudrate or can bus bitrate launched as a service at startup

Hello we have a hardware platform with serial ports and can buses. Those are configured by running services at startup. The question is how to change settings such as baudrate of serial ports that survive after reboot. The only way I see is to launch an awk or sed script that change the settings directly in the service file. However how to launch that script from our own snap application ? Do you have a better way to perform what we want to achieve?


Can you provide an example of which service files you are modifying and how you need to modify them?

Also what is the operating system you are using this with? I assume you have a snap application that needs the serial ports to be configured a certain way, is that correct? How are you accessing the serial ports from the application currently?