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 ...
随机推荐
- 微软Power BI 每月功能更新系列——12月Power BI 新功能学习
Power BI Desktop12月产品功能摘要 Power BI 作为实力宠粉达人每月更新不来点新花样,怎么对得起翘首期待的实力铁粉您嘞!一起来看看这一次的Power BI版本的更新又给我们带来了 ...
- foreach遍历数组、数组的转置与方阵的迹
public class Copy1 { public static void main(String[] args) { array1(); //如果不初始化元素,默认为0 int [][] a = ...
- ix 混合索引
raw_datas #DateFrame diff_index_list = [] #行index #多行所有列索引 raw_datas.ix[diff_index_list] #多行一列索引raw_ ...
- Angular 插值字符串
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...
- [LeetCode&Python] Problem 830. Positions of Large Groups
In a string S of lowercase letters, these letters form consecutive groups of the same character. For ...
- [LeetCode&Python] Problem 206. Reverse Linked List
Reverse a singly linked list. Example: Input: 1->2->3->4->5->NULL Output: 5->4-> ...
- C语言--第八周作业评分(5班)
作业链接:https://edu.cnblogs.com/campus/hljkj/CS2017-5/homework/1400 一.评分要求 要求1 完成14.15周的所有PTA中题目集,总共4次题 ...
- FZU软工第三次作业-原型设计
目录 00.前言: 01.PSP表格: 02.需求分析--NABCD模型 N-- Need 需求 A-- Approach 做法 B-- Bnefit 好处 C-- Competitors 竞争 D- ...
- 下面有关 JAVA 异常类的描述,说法正确的有()
都是Throwable的子类: 1.Exception(异常) :是程序本身可以处理的异常. 2.Error(错误): 是程序无法处理的错误.这些错误表示故障发生于虚拟机自身.或者发生在虚拟机试图执行 ...
- 求两个数之间的质数 -----------基于for循环 算法思想
前端代码: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.as ...