Ubuntu 18.04 rc.local systemd设置
ubuntu18.04不再使用initd管理系统,改用systemd。
然而systemd很难用,改变太大,跟之前的完全不同。
使用systemd设置开机启动
为了像以前一样,在/etc/rc.local中设置开机启动程序,需要以下几步:
1、systemd默认读取/etc/systemd/system下的配置文件,该目录下的文件会链接/lib/systemd/system/下的文件。一般系统安装完/lib/systemd/system/下会有rc-local.service文件,即我们需要的配置文件。
链接过来:
ln -fs /lib/systemd/system/rc-local.service /etc/systemd/system/rc-local.service
cd /etc/systemd/system/
cat 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]
WantedBy=multi-user.target
Alias=rc-local.service
1) [Unit] 区块:启动顺序与依赖关系。
2) [Service] 区块:启动行为,如何启动,启动类型。
3) [Install] 区块,定义如何安装这个配置文件,即怎样做到开机启动。
2、创建/etc/rc.local文件
sudo touch /etc/rc.local
3、赋可执行权限
chmod /etc/rc.local
4、编辑rc.local,添加需要开机启动的任务
#!/bin/bash echo "test rc " > /var/test.log
5、执行reboot重启系统,然后查看test.log
Ubuntu 18.04 rc.local systemd设置的更多相关文章
- 转载:如何在Ubuntu 18.04上使用UFW设置防火墙
https://blog.csdn.net/u013068789/article/details/82051943 介绍 UFW或Uncomplicated Firewall是iptables一个接口 ...
- Ubuntu 18.04 Numix主题安装设置
Ubuntu 18.04 Numix主题安装设置 一.首先安装Numix主题 展现效果如下图 1.安装numix sudo add-apt-repository ppa:numix/ppa 2.安装主 ...
- Ubuntu 18.04 LTS IP 地址设置
和之前的版本不太一样, Ubuntu 18.04 的 ip地址设置是用netplan管理的 配置文件在: /etc/netplan/50-cloud-init.yaml 示例文件如下: # T ...
- 如何在Ubuntu 18.04上安装Go
如何在Ubuntu 18.04上安装Go 谢鸢发表于云计算教程系列订阅98 介绍 课程准备 第1步 - 安装Go 第2步 - 设置Go路径 第3步 - 测试您的安装 结论 介绍 Go是Google开发 ...
- [ubuntu 18.04 + RTX 2070] Anaconda3 - 5.2.0 + CUDA10.0 + cuDNN 7.4.1 + bazel 0.17 + tensorRT 5 + Tensorflow(GPU)
(RTX 2070 同样可以在 ubuntu 16.04 + cuda 9.0中使用.Ubuntu18.04可能只支持cuda10.0,在跑开源代码时可能会报一些奇怪的错误,所以建议大家配置 ubun ...
- Ubuntu 18.04 设置开机启动脚本 rc.local systemd
ubuntu18.04不再使用initd管理系统,改用systemd. ubuntu-18.04不能像ubuntu14一样通过编辑rc.local来设置开机启动脚本,通过下列简单设置后,可以使rc.l ...
- Ubuntu 18.04 启用 rc.local 设置开机启动
ubuntu18.04 不再使用initd管理系统,改用systemd. 然而systemd很难用,改变太大,跟之前的完全不同. 使用systemd设置开机启动为了像以前一样,在/etc/rc.loc ...
- ubuntu 18.04 配置 rc.local
ubuntu 18.04 配置 rc.local:https://blog.csdn.net/a912952381/article/details/81205095 Ubuntu /etc/rc.lo ...
- Ubuntu 18.04 Server 设置静态IP
一.背景 Netplan是Ubuntu 17.10中引入的一种新的命令行网络配置实用程序,用于在Ubuntu系统中轻松管理和配置网络设置.它允许您使用YAML抽象来配置网络接口.它可与NetworkM ...
随机推荐
- Android驱动中的remap_pfn_range()校验漏洞(CVE-2013-2596)
简单介绍 当然类似函数还有io_remap_pfn_range(). remap_pfn_range() 为用户态提供了一种手段访问内核地址空间.它通过新页表,将一块内核物理内存映射到用户态进程空间. ...
- PRCT-1302 the OCR has an invalid ip address
PRCT-1302 the OCR has an invalid ip address 1. 报错信息 an internal error occurred within cluster verifi ...
- 【leeetcode】125-Valid Palindrome
problem 125. Valid Palindrome 参考 1. Leetcode_Valid Palindrome; 完
- 一种安装openslide的简易方法
直接百度谷歌搜索可能需要手动编译安装,能不能用通过一两句命令行的方式安装openslide?网上给出的教程确实都是通过源安装python-openslide,实际上这样安装,即使安装很多依赖库之后仍然 ...
- 百练6376-二维数组右上左下遍历-2015正式C题
C:二维数组右上左下遍历 总时间限制: 1000ms 内存限制: 65536kB 描述 给定一个row行col列的整数数组array,要求从array[0][0]元素开始,按从左上到右下的对角线顺 ...
- url的反向解析
1. url的语法格式: url(regex, views, **kwargs, name) name:为地址起别名,反向解析时使用 2.反向解析 对于Django中的url反向解析,是分模板和视图的 ...
- 对于vs出现“This function or variable may be unsafe”
1.项目上右击选择“属性” 2.选择C/C++ ->预处理器 ->预处理器定义 3.添加一行 _CRT_SECURE_NO_WARNINGS 4.点击确定,重新编译成功.
- PWA需要的技术
1 Manifest https://developer.mozilla.org/zh-CN/docs/Web/Manifest 2 Service Work ...
- linux通过安装包安装nginx和jdk
1.安装prce(重定向支持)和openssl(https支持,如果不需要https可以不安装.) yum -y install pcre* yum -y install openssl* 2.下载n ...
- Elasticsearch基本用法(2)--Spring Data Elasticsearch
Spring Data Elasticsearch是Spring Data项目下的一个子模块. 查看 Spring Data的官网:http://projects.spring.io/spring-d ...