例如:在KylinV10操作系统中,开机自启动depmod -a
#创建服务单元 vi /etc/systemd/system/depmod.service #写入配置 [Unit] Description=Run depmod at boot After=systemd-modules-load.service [Service] Type=oneshot ExecStart=/sbin/depmod -a [Install] WantedBy=multi-user.target # 重载systemd配置 systemctl daemon-reload # 设置开机启用 systemctl enable depmod.service # 立即测试执行一次 systemctl start depmod.service # 查看运行状态 systemctl status depmod.service