ubuntu添加自启动
原创不易,转载请注明来源,谢谢
-
创建脚本
web
#!/bin/bash # chkconfig: 2345 55 25 # description: bt Cloud Service ### BEGIN INIT INFO # Provides: web # Required-Start: $all # Required-Stop: $all # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: starts web # Description: starts the web ### END INIT INFO sudo docker start mysql57 sudo mount -t virtiofs ProjectWeb /www/wwwroot -
添加到
/etc/init.d
下面ln -s xxx/web /etc/init.d/web -
开启自启动
systemctl enable web -
如果不需要了 执行删除
rm -rf /etc/init.d/web update-rc.d -f web remove
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步