Bootstrap

Ubuntu开机自动执行脚本

Ubuntu自动执行can脚本
之前一直弄不好下面这个脚本自启动

#!/bin/bash
sudo modprobe can
sudo modprobe can-raw
sudo modprobe can-bcm
sudo modprobe can-gw
sudo modprobe can_dev
sudo modprobe mttcan
sudo ip link set can0 type can bitrate 1000000 loopback on
sudo ip link set up can0
sudo ip link set can1 type can bitrate 1000000 loopback on
sudo ip link set up can1

今天好像弄成功了
首先查看 rc-local.service 文件有没有

cd /lib/systemd/system/
vi rc-local.service

rc-local.service文件内容如下

#  SPDX-License-Identifier: LGPL-2.1+
#
#  This file is part of systemd.
#
#  systemd is free
;