解决深度桌面操作系统/etc/rc.local开机启动问题

1,005次阅读
没有评论

共计 1354 个字符,预计需要花费 4 分钟才能阅读完成。

背景

由于某些软件并没有增加开启启动的服务,很多时候需要手工添加,一般我们都是推荐添加命令到 /etc/rc.local 文件,但是深度桌面操作系统默认不带 /etc/rc.local 文件,而 rc.local 服务却还是自带的,如下:

root@mrcgl-PC:/home/mrcgl# sudo cat /lib/systemd/system/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(8)
ConditionFileIsExecutable=/etc/rc.local
After=network.target

[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
RemainAfterExit=yes
GuessMainPID=no

解决方式

1、手工添加一个 /etc/rc.local 文件

#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.

touch /var/lock/subsys/local

2、赋予执行权限

chmod +x /etc/rc.local

3、启动 rc-local 服务

systemctl start rc-local

4、然后就可以把需要开机启动的命令添加到 /etc/rc.local 文件,丢在 touch /var/lock/subsys/local 前面即可

打赏小哥

解决深度桌面操作系统 /etc/rc.local 开机启动问题 微信打赏 解决深度桌面操作系统 /etc/rc.local 开机启动问题 支付宝打赏

正文完
 0
评论(没有评论)