Linux onboot怎样配置
要配置Linux系统开机自启动的服务或脚本,可以依照以下步骤进行操作:
打开终端,使用root权限登录系统。
编辑/etc/rc.local文件,可使用vi或其他文本编辑器打开这个文件:
sudo vi /etc/rc.local
#!/bin/sh -e
#
# 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.
# Start service
/usr/bin/service_name start
# Run script
/path/to/script.sh
exit 0
保存文件并退出编辑器。
授与rc.local文件履行权限,确保其可以在系统启动时被履行:
sudo chmod +x /etc/rc.local
注意:在配置开机自启动时,确保添加的命令或脚本路径是正确的,否则可能致使启动失败。另外,也能够通过systemd服务来配置开机自启动,具体操作可以参考systemd的相关文档。
tiktok粉丝购买:https://www.smmfensi.com/
TOP