ubuntu 开启rc.local
1、创建rc.local.service
服务的软链接
ln -s /lib/systemd/system/rc-local.service /etc/systemd/system/rc-local.service touch /etc/rc.local chmod +x /etc/rc.local
2、修改 /etc/rc.local
#!/bin/bash #你的命令,不要有死循环或无法退出的程序,不然进不了系统 #mount -t 9p -o trans=virtio hostshare /mnt/share exit 0
3、直接执行生效
/etc/rc.local start
4、rc-local.service 文件内容
# SPDX-License-Identifier: LGPL-2.1+ # # This file is part of systemd. # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # This unit gets pulled automatically into multi-user.target by # systemd-rc-local-generator if /etc/rc.local is executable. [Unit] Description=/etc/rc.local Compatibility Documentation=man:systemd-rc-local-generator(8) ConditionFileIsExecutable=/etc/rc.local After=network.target [Service] Type=forking ExecStart=/etc/rc.local start TimeoutSec=0 RemainAfterExit=yes GuessMainPID=no
QQ:328864113 微信:wuhg2008
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!
2018-10-16 学习openvpn04
2018-10-16 学习openvpn02
2018-10-16 学习openvpn01