【Linux】开机自启动

修改开机启动文件:/etc/rc.local

sudo vim /etc/rc.local

编写命令,一定要将命令添加在 exit 0之前。

#!/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

最后修改rc.local文件的执行权限

sudo chmod +x /etc/rc.local
sudo chmod 755 /etc/rc.local

例子:自动启动 Frp

nohup /home/iecube/frp_0.37.1_linux_amd64/frpc -c /home/iecube/frp_0.37.1_linux_amd64/frpc.ini &

发表评论

您的邮箱地址不会被公开。 必填项已用 * 标注