欢迎来到资源库(www.zyku.net)

Debian

当前位置:首页 > 服务器教程 > Debian > rc-local

Debian 启用 /etc/rc.local 添加开机自启动服务

时间:2022-03-31|栏目:Debian|点击:|我要投稿

Debian 中在 /etc/rc.local 添加命令即可实现开机自动执行命令/开机自启动。

Debian 9 自带有 rc-local 服务,但是没有启动,也没有 /etc/rc.local 文件。

首先看看 rc-local 服务有没有启动 systemctl status rc-local 显示Active: inactive (dead)就是没有启动。

那么首先添加 /etc/rc.local 文件。

新建vim /etc/rc.local文件,写入以下内容:

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

exit 0

给予权限:

chmod +x /etc/rc.local

启动 rc-local 服务:

systemctl start rc-local

然后就可以编辑 /etc/rc.local 文件,把需要开机自动执行的命令写在 exit 0 前面。

(资源库 www.zyku.net)

上一篇:Debian安装Docker教程

栏    目:Debian

下一篇:debain 系统 ll 命令无法使用以及目录和文件没有颜色区分解决方法

本文标题:Debian 启用 /etc/rc.local 添加开机自启动服务

本文地址:https://www.zyku.net/debian/11111.html

关于我们 | 版权申明 | 寻求合作 |

重要申明:本站所有的文章、图片、评论等内容,均由网友发表或上传并维护或收集自网络,仅供个人学习交流使用,版权归原作者所有。

如有侵犯您的版权,请与我们联系,我们将在24小时内进行处理、任何非本站因素导致的法律后果,本站均不负任何责任。

联系QQ:95148658 | 邮箱:mb8#qq.com(#换成@)

苏ICP备2020066115号-1

本网站由提供CDN加速/云存储服务