说明:很多时候有些程序或者脚本都需要添加开机自启,最简单的方法就是使用rc.local
自启,不过由于系统版本更替,很多新版本系统都没有rc.local
文件了,比如Debian 9
、Ubuntu 17.10
、Ubuntu 18.04
。这时候就需要我们手动设置下。
方法
1、添加rc-local.service
#以下为一整条命令,一起复制运行
cat > /etc/systemd/system/rc-local.service <<EOF
[Unit]
Description=/etc/rc.local
ConditionPathExists=/etc/rc.local
[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99
[Install]
WantedBy=multi-user.target
EOF
2、新建rc-local文件
#以下为一整条命令,一起复制运行
cat > /etc/rc.local <<EOF
#!/bin/sh
#
# 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
EOF
3、添加权限并设置开机自启
chmod +x /etc/rc.local
systemctl enable rc-local
systemctl start rc-local.service
检查状态:
systemctl status rc-local.service
返回Active:active
信息,则成功。
最后我们就可以在/etc/rc.local
里,添加开机的自启命令什么的了。记住添加在exit 0
之前。
未经允许不得转载:嘟嘟 » Debian 9/Ubuntu 17+添加rc.local开机自启的方法
最新评论
请问下,python3 tg_username_update.py都会提示下面这个是因为什么啊 Traceback (most recent call last): File "tg_username_update.py", line 21, in <module> cake = emojize(":cake:", use_aliases=True) TypeError: emojize() got an unexpected keyword argument 'use_aliases'
不可以了
# Install [Debian] [bullseye] [amd64] Downloading... grep: (standard input): binary file matches Error! grub.cfg. root@RRR2:~#
博主你好,请问cloudfront 上传收费这个是事实吧,已经找了几个贴子确认了。 那有什么好办法能够避开这个收费呢?如果不能避开感觉还是cloudflare 比较稳。
来看看
第5步添加自定义主机名进去后等txt验证提示custom hostname does not name to this zone
那没事了,我静态博客。谢谢
为什么缓存键和源请求那里不设置缓存?