Skip to content

Instantly share code, notes, and snippets.

@splatch
Forked from sebastianhaas/socketcan-interface.service
Last active November 1, 2020 21:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save splatch/e58b03c0c5d8740eba9b61971614e80e to your computer and use it in GitHub Desktop.
Save splatch/e58b03c0c5d8740eba9b61971614e80e to your computer and use it in GitHub Desktop.
An example systemd template unit file to setup a SocketCAN interface on startup
[Unit]
Description=SocketCAN interface %i with a baudrate of 500000
After=multi-user.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/sbin/ip link set %i type can bitrate 500000 ; /sbin/ifconfig %i up
ExecReload=/sbin/ifconfig %i down ; /sbin/ip link set %i type can bitrate 500000 ; /sbin/ifconfig %i up
ExecStop=/sbin/ifconfig %i down
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment