Skip to content

Running as a systemd service

Matt Clarke edited this page Jan 3, 2022 · 3 revisions

Getting MAVProxy to run as a system service is straightforwards.

You need to create a service definition in /lib/systemd/system/:

sudo nano /lib/systemd/system/mavproxy.service

Paste this in:

[Unit]
Description=MAVProxy
After=network.target

[Service]
Environment="HOME=/home/<YOUR USERNAME HERE>/"
ExecStart=/usr/local/bin/mavproxy.py --master=/dev/ttyACM0 --baudrate 115200  --daemon
Restart=on-failure
WorkingDirectory=/home/<YOUR USERNAME HERE>/
StandardOutput=inherit
StandardError=inherit
Restart=always

[Install]
WantedBy=multi-user.target

Make sure to update --master to point at the connected MAVLink controller, and to correctly set Environment + WorkingDirectory for your username.

Then, you can enable and start the service:

sudo systemctl enable mavproxy.service
sudo systemctl start mavproxy.service
Clone this wiki locally