开机自动登录启动(centos参考):
(1)本地必须先手动输入帐号密码成功登录一次;
(2)执行“chmod +x /etc/rc.d/rc.local”命令确保有权限;
(3)把启动程序的命令添加到/etc/rc.d/rc.local文件中,此文件内容如下,
#!/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
cd /root/frpc --本地实际安装目录
mono ./frpc -c ./frpc.ini & --自动读取上次成功登录帐号并以后台服务启动
开机自动登录启动(ubuntu参考):
(1)本地必须先手动输入帐号密码成功登录一次;
(2)执行“chmod +x /etc/rc.local”命令确保有权限;
(3)把启动程序的命令添加到/etc/rc.local文件中,此文件内容如下,
#!/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.
cd /root/frpc --本地实际安装目录
mono ./frpc -c ./frpc.ini & ---自动读取上次成功登录帐号并以后台服务启动
exit 0
开机自动登录启动(ubuntu参考二):
(1)执行“chmod +x /etc/rc.local”命令确保有权限;
(2)把启动程序的命令添加到/etc/rc.local文件中,此文件内容如下,
#!/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.
cd /root/frpc
screen -S frpc ----确保本地可执行screen,通过它单独调用当后台进程运行
mono ./frpc -c ./frpc.ini autologin username password
exit 0
在如上代码中,实际路径和自己的帐号密码换为自己的即可。
其他linux开机自动登录启动参考:
参考如上centos/ubuntu方法,如不确定rc.local路径,可以“find / -name rc.local”查看。文件路径和帐号密码以自己实际为准。有图形界面的同样可以通过界面添加开机自启动。
提示:
1,推荐使用 mono ./frpc -c ./frpc.ini & 自动登录方式,此命令支持断网自动重连。
2,带帐号mono ./frpc -c ./frpc.ini autologin username password方式时,如开机时未及时联网成功,可能会导致登录失败。
3,建议"find / -name rc.local"命令查看核实本地rc.local文件实际路径,不同环境系统下此文件路径不同。
参考链接:http://www.nat123.com/pages_17_619.jsp