-
-
Notifications
You must be signed in to change notification settings - Fork 13.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
frp怎样开机启动和后台运行? #176
Comments
nohup 后台可以用 |
supervisor |
@impig33 建议这一类的问题可以通过搜索引擎自行解决。 |
二更@20210519 如果想自己手写,参照如下:已经解决: vi /etc/systemd/system/frps.service 新建此文件,并写入以下内容 [Service] [Install] 启动并设为开机自启。 参照:lcbk.net/9766.html ------------centos6.5及以下--------------------- . |
太好用了,使用特权模式服务端免配置,太好用了,谢谢作者。 |
贴一下我之前无法开机自启frpc的解决办法,原因可能是因为系统开机并未准备好网络,或者其它依赖
按如下修改
使用 |
@vc5 👍 也可以试试 0.11.0 frpc 新增的 login_fail_exit 参数设置为 false,这样启动时没连上服务器就不会自动退出了,而是每隔30s自动重连。 |
http://free-e.net/109 这篇文章能帮助到您。 |
If you don't have systemd or your kernel don't support systemd, this is my init.d service file:
Hope this can help you. |
This Version Allow run as
|
centos 6.5 init.d script inspire by ensure binary in #!/bin/bash
# chkconfig: - 85 15
# # description: frp init script
RETVAL=0
PROG="frpc"
EXEC="/usr/bin/frpc"
LOCKFILE="/var/lock/subsys/$PROG"
OPTIONS="-c /etc/frp/frpc.ini"
# Source function library.
if [ -f /etc/rc.d/init.d/functions ]; then
. /etc/rc.d/init.d/functions
else
echo "/etc/rc.d/init.d/functions is not exists"
exit 0
fi
start() {
if [ -f $LOCKFILE ]
then
echo "$PROG is already running!"
else
echo -n "Starting $PROG: "
#$EXEC $OPTIONS &
nohup $EXEC $OPTIONS >/dev/null 2>&1 &
RETVAL=$?
[ $RETVAL -eq 0 ] && touch $LOCKFILE && success || failure
echo
return $RETVAL
fi
}
stop() {
echo -n "Stopping $PROG: "
killproc $EXEC
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -r $LOCKFILE && success || failure
echo
}
restart ()
{
stop
sleep 1
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status $PROG
;;
restart)
restart
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
esac
exit $RETVAL in server with ubuntu 16.04, systemd is available [Unit]
Description=Frps Service
After=network.target
Wants=network.target
[Service]
Type=simple
PIDFile=/var/run/frps.pid
ExecStart=/usr/sbin/frp/frps -c /etc/frp/frps.ini
Restart=on-failure
[Install]
WantedBy=multi-user.target |
万分感谢!!! |
两个问题:
1.在centos上如何开机运行?
2.怎样后台运行,而不用一直开着putty
谢谢
已经解决:
二更@20210519
现在下载的frp打包文件目录内,已经写好了后台运行启动文件,比如服务器端,只需要把frps.service复制一份到/etc/systemd/system目录下即可。
如果想自己手写,参照如下:
使用systemd配置开机自启,适用于 centos7 Ubuntu 16 或 debian 8。
vi /etc/systemd/system/frps.service 新建此文件,并写入以下内容
:
[Unit]
Description=frps daemon
[Service]
Type=simple
ExecStart=/usr/bin/frps -c /etc/frps/frps.ini
[Install]
WantedBy=multi-user.target
启动并设为开机自启。
$ systemctl start frps
$ systemctl enable frps
参照:lcbk.net/9766.html
------------centos6.5及以下---------------------
vi /etc/rc.local
在最下面加一行/usr/sbin/frp/frps -c /usr/sbin/frp/frps.ini
其中 /usr/sbin/frp是程序放置的目录,重启ok
The text was updated successfully, but these errors were encountered: