Mavproxy and Systemctl

I created a systemctl service that runs at startup executing mavproxy, it connects with my vehicle without problems. The one thing it doesn’t do without problems is creating two additional outputs.

Inside my service, at execstart, I have after

–master=/dev/ttys0 --baudrate 230400 --out --out tcpin:

That works when using as command line.

I tried creating a separate environmental file that have these values following the steps from another topic here with the same problem, but it didn’t work.

Can someone help?

What I did to set it up at boot is using a python script that runs from crontab or rc.local.
The good thing is 1) I can just change a text file or database as and when my program require a change for example a remote user request to add new ip or remove ip it will be done so at each reboot.
2) it’s running in root, so it has the permission required to do anything.
3) With crontab I can constantly monitor mavproxy is running and kills it if it stall (which almost never happened) and restart

I never try systemctl with mavproxy maybe someone knows it well can advice.

Hello, thank you for answering.
If it’s not a bother, could you talk me through the steps?

I use systemctl. But instead of executing python/ directly via systemctl, I created a small shell script that sets environment variables, etc. and then runs python/ .

I like systemctl better than crontab because it’s easier to bounce services and to see the stdout/stderr from the services.

1 Like

I create a startup script in sudo crontab -e to run @reboot
the script will read all the variables from my database for example which ip to send out. Then launch mavproxy from there.
A second script is constantly running every second to ensure that the mavproxy is running incase for any reasons it was no responding or just disappear, it will restart (Usually this only happens when my script has some bugs) that’s how I do.
I don’t want my drone to lose control or fall out of the sky out of sudden.