直接编辑文件 /etc/rc.local
vim /etc/rc.loca 或者 vi /etc/rc.loca
出现
======================================
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff
touch /var/lock/subsys/local
==============================================
在文件中加上你需要启动的程序或命令
如我在VPS里面做了个开机就访问自己的网站
elinks --dump http://www.dzxx.cn/
编辑完后:w :q 然后REBOOT
一次性测试成功
本文介绍如何通过编辑 rc.local 文件来实现 Linux 系统开机时自动执行特定命令或程序的方法。具体步骤包括使用 vim 或 vi 编辑器打开 rc.local 文件,在文件末尾添加所需的命令或脚本,并确保正确保存更改。示例中展示了一个简单的 elinks 命令,用于在 VPS 开机时自动访问指定网址。
528

被折叠的 条评论
为什么被折叠?



