rc.local(ubuntu18.04)
系统自带服务/lib/systemd/system/rc-local.service
软连接为 /lib/systemd/system/rc.local.service -> 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()
ConditionFileIsExecutable=/etc/rc.local
After=network.target [Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=
RemainAfterExit=yes
GuessMainPID=no
可以看到此文件缺少[install]部分,为他加上。
[Install]
WantedBy=multi-user.target
输入systemctl enable rc-local.service
系统启动时将执行/etc/rc.local文件里的内容
16.10开始不再有/etc/rc.local文件
创建
printf '%s\n' '#!/bin/bash' 'exit 0' | sudo tee -a /etc/rc.local
vim /etc/rc.local
添加以下内容用于测试
#!/bin/bash touch /var/lock/subsys/local source /etc/profile echo `date`,"ok" >>/tmp/test-rc-local.log
sudo chmod +x /etc/rc.local
重启后看效果
rc.local(ubuntu18.04)的更多相关文章
- Ubuntu 18.04 启用 rc.local 设置开机启动
ubuntu18.04 不再使用initd管理系统,改用systemd. 然而systemd很难用,改变太大,跟之前的完全不同. 使用systemd设置开机启动为了像以前一样,在/etc/rc.loc ...
- Ubuntu 18.04 设置开机启动脚本 rc.local systemd
ubuntu18.04不再使用initd管理系统,改用systemd. ubuntu-18.04不能像ubuntu14一样通过编辑rc.local来设置开机启动脚本,通过下列简单设置后,可以使rc.l ...
- Ubuntu 18.04 rc.local systemd设置
ubuntu18.04不再使用initd管理系统,改用systemd. 然而systemd很难用,改变太大,跟之前的完全不同. 使用systemd设置开机启动为了像以前一样,在/etc/rc.loca ...
- ubuntu 18.04 配置 rc.local
ubuntu 18.04 配置 rc.local:https://blog.csdn.net/a912952381/article/details/81205095 Ubuntu /etc/rc.lo ...
- Ubuntu 16.04设置rc.local开机启动命令/脚本的方法
Ubuntu 16.04设置rc.local开机启动命令/脚本的方法 Ubuntu 16.04设置rc.local开机启动命令/脚本的方法(通过update-rc.d管理Ubuntu开机启 ...
- Ubuntu 16.04设置rc.local开机启动命令/脚本的方法(通过update-rc.d管理Ubuntu开机启动程序/服务)
注意:rc.local脚本里面启动的用户默认为root权限. 一.rc.local脚本 rc.local脚本是一个Ubuntu开机后会自动执行的脚本,我们可以在该脚本内添加命令行指令.该脚本位于/et ...
- Ubuntu 16.04出现:"Failed to start /etc/rc.local Compatibility"的问题解决思路
"Failed to start /etc/rc.local Compatibility"这个错误没有最终解决方法,之后思路,如下: 1.打开/etc/rc.local看是否有其它 ...
- ubuntu-18.04 设置开机启动脚本-亲测有效
ubuntu-18.04不能像ubuntu14一样通过编辑rc.local来设置开机启动脚本,通过下列简单设置后,可以使rc.local重新发挥作用. 2.将下列内容复制进rc-local.servi ...
- ubuntu-18.04 设置开机启动脚本
ubuntu-18.04 设置开机启动脚本 参阅下列链接 https://askubuntu.com/questions/886620/how-can-i-execute-command-on-sta ...
随机推荐
- HNU 2015暑期新队员训练赛2 H Blanket
把每个 bi *x + ri ( 0 <= ri <= ai)标记, 输出被标记 0 – N 次的个数 #include<iostream> #include<cstdi ...
- 通过dd命令显示硬盘的读写性能
测试vdb硬盘的读写速度 1.分区格式化挂载vdb硬盘 2.新建写入文件2 3.测试:文件2中写入数据,设置块大小为100M,拷贝块个数为5 经过测试:测试效果一般count越高越准确,建议为300, ...
- hadoop 透明加密
hadoop 透明加密 hadoop 透明加密 kms transparent 2015年04月09日 18:12:20 糖糖_ 阅读数:12248 标签: transparenthadoop kms ...
- Java红黑树详谈
定义 红黑树的主要是想对2-3查找树进行编码,尤其是对2-3查找树中的3-nodes节点添加额外的信息.红黑树中将节点之间的链接分为两种不同类型,红色链接,他用来链接两个2-nodes节点来表示一个3 ...
- swift 实践- 02 -- 自定义cell 的简单使用
import UIKit class MyTableViewCell: UITableViewCell { var imageV: UIImageView? var titleLabel: UILab ...
- C# 通用数据库配置界面,微软原生DLL重整合
C# 通用数据库配置界面,微软原生DLL重整合 自己整合了 微软自带的数据连接配置界面对话库 Microsoft.Data.ConnectionUI.Dialog.dll 微软自带的数据连接配 ...
- NPOI写Excel,Microsoft.Office.Interop.excel.dll 转换Excel为PDF
首先要引用NPOI动态库和Microsoft.Office.Interop.excel.dll (Microsoft.Office.Interop.excel.dll 下载链接 ,下载以后解压文件,把 ...
- tensorflow(4):神经网络框架总结
#总结神经网络框架 #1,搭建网络设计结构(前向传播) 文件forward.py def forward(x,regularizer): # 输入x 和正则化权重 w= b= y= return y ...
- hdu5015构造转移矩阵
/* 构造转移矩阵: 先推公式: 首先是第0行:A[0][j+1]=A[0][j]*10+3 1-n行: A[i][j+1]=A[i][j]+A[i-1][j+1]=... =A[i][j]+A[i- ...
- Nginx详解二十三:Nginx深度学习篇之Nginx+Lua开发环境搭建
Nginx+Lua开发环境 1.下载LuaJIT解释器wget http://luajit.org/download/LuaJIT-2.0.2.tar.gztar -zxvf LuaJIT-2.0.2 ...