找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 6362|回复: 0

Linux或CentOS中把frpc做成服务形式的操作方法

[复制链接]

305

主题

42

回帖

1421

积分

超级版主

积分
1421
发表于 2024-5-19 22:30:41 | 显示全部楼层 |阅读模式
Linux或CentOS中把frpc做成服务形式的操作方法(以服务形式启动),如下所示:

#!/bin/bash
# this script create it by caffreyxin at 2007.10.15.
# it is v.0.0.1 version.
# if you find any errors on this scripts, please contact caffreyxin.
# and send mail to xinyflove at sina dot com.
#
# chkconfig: - 85 15

nginxd=/usr/sbin/frpc
nginx_config=/etc/frpc.toml
nginx_pid=/var/run/frpc.pid

RETVAL=0
prog="frpc"

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

[ -x $frpcd ] || exit 0


start() {
    echo "Starting frpc"
    /usr/sbin/frpc -c /etc/frpc.toml >/dev/null 2>&1 &
}


stop() {
    echo "Stopping frpc"
    killall -9 frpc >/dev/null 2>&1 &
}



# See how we were called.
case "$1" in
start)
        start
        ;;

stop)
        stop
        ;;

restart)
        stop
        start
        ;;

status)
        status $prog
        RETVAL=$?
        ;;
*)
        echo $"Usage: $prog {start|stop|restart|reload|status|help}"
        exit 1
esac

exit $RETVAL


您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|333cm ( 京ICP备16037542号 )

GMT+8, 2025-7-1 15:08 , Processed in 0.084735 second(s), 21 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表