修改开机启动文件:/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 &