Created
April 20, 2026 12:37
-
-
Save grodansparadis/16e010326dc1ceedb0dcd162ac6c153e to your computer and use it in GitHub Desktop.
Autostart socketcan channels using systemd on Linux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Create service file | |
| ```bash | |
| [Unit] | |
| Description=can0 | |
| [Service] | |
| ExecStartPre=/sbin/ip link set can0 type can bitrate 125000 restart-ms 100 | |
| ExecStart=/sbin/ip link set can0 up txqueuelen 128 | |
| Restart=on-failure | |
| RestartSec=1 | |
| [Install] | |
| WantedBy=multi-user.target | |
| ``` | |
| # Install service | |
| ```bash | |
| sudo cp can0.service /etc/systemd/system | |
| sudo systemctl start can0 | |
| sudo systemctl enable | |
| ``` | |
| Can do this with virtual channels as well. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment