you'll need a systemd service.
Create a file following this template in /lib/systemd/system/serialosc.service:
[Unit]
Description=serialosc daemon
[Service]
Type=simple
ExecStart=/usr/local/bin/serialoscd
PIDFile=/var/run/serialoscd.pid
RemainAfterExit=no
Restart=on-failure
RestartSec=5s
[Install]
WantedBy=multi-user.target
then edit the ExecStart line to match your executable file path.
Then execute
- to start the service:
systemctl start serialosc
- to stop the service:
systemctl stop serialosc
- to look at the output:
journalctl -fu serialosc
- to enable it at startup
systemctl enable serialosc
- to disable it at startup
systemctl disable serialosc
Ultimately, I just realised that the serialosc daemon used for the monome may already do all you need ... see here