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 ...
随机推荐
- HDU 5288 OO’s Sequence
题意: 给你一个序列, 有一个函数 F(L,R) 其中 ai 均不能 被 aL - aR整除的 函数值是这个ai个数 思路 : 反过来求 满足这样的条件的 ai 的区间,然后求和 #include& ...
- 本地项目提交到github和提交更新(转)
一:首先当然是去github注册账号了. 二:注册完毕登录后,在自己的首页上面点击右上角“+”号,然后选择New repository,或者直接点击下面的绿色按钮,创建一个新仓库.如图: 然后填入仓库 ...
- 所有ORM操作 (第二版)
####################################################################### # PUBLIC METHODS THAT ALTER ...
- Day7--------------虚拟机网络服务
1.桥接 连接到本地的网卡,把本机的网卡看作是虚拟交换机 ping ip地址 arping -i eth0 192.168.11.11 返回物理MAC地址 #可以检查是否有重复 ...
- nginx负载均衡后端tomcat无法加载js资源
JS或css无法完全加载 nginx的代理缓存区,默认较小导致部分文件出现加载不全的问题,比较典型的如jQuery框架,可以通过配置调整nginx的缓存区即可.主要参考proxy参数 最终完整配置如下 ...
- c#在Excel指定单元格中插入图片
方法一: /// 将图片插入到指定的单元格位置,并设置图片的宽度和高度./// 注意:图片必须是绝对物理路径/// </summary>/// <param name="R ...
- bat脚本(转)
偶尔用到,搜到不错的资料,所以转一下: windows bat脚本for循环中对变量循环赋值 http://blog.csdn.net/u010161379/article/details/50956 ...
- ORA-00257: archiver error. Connect internal only, until freed.| Oracle数据库归档日志满导致应用系统反应缓慢的问题处理
一:查看原因 查看了下V$FLASH_RECOVERY_AREA_USAGE,看看归档目录使用的情况.果然是归档满了. Disconnected from Oracle Database 11g En ...
- CentOS 7 安装 Redis
1.Redis 下载地址:https://redis.io/download 2.上传到服务器指定文件夹 ,我这边传到了根目录下 /mysoft 这个目录下 解压 tar -zxvf redis- ...
- LeetCode(110):平衡二叉树
Easy! 题目描述: 给定一个二叉树,判断它是否是高度平衡的二叉树. 本题中,一棵高度平衡二叉树定义为: 一个二叉树每个节点 的左右两个子树的高度差的绝对值不超过1. 示例 1: 给定二叉树 [3, ...