CentOS開機啓動frp

 

建立文件,並輸入以下內容:bash

vi /usr/frp/start_frp
nohup /usr/frp/frps -c /usr/frp/frps.ini >/root/frp_log 2>&1 &

受權:code

chmod +x /usr/frp/start_frp

創建自啓動腳本:server

vi /etc/init.d/frp

輸入以下內容:隊列

#!/bin/bash
#
# frp startup script for the server
#
# chkconfig: 2345 90 10
# description: start the frp
#
# Source function library
. /etc/rc.d/init.d/functions
 
#腳本名稱
prog=frp

#frp安裝目錄
FRP_HOME=/usr/frp
export FRP_HOME

#frp運行命令
FRP_RUN_SERVICE=/usr/frp/start_frp


case "$1" in
    start)
    echo "Starting frp..."
    $FRP_RUN_SERVICE
    ;;
 
*)
    echo "Usage: $prog {start}"
    ;;
esac
exit 0

修改文件爲可運行文件:ip

chmod a+x frp

查看frp開機啓動狀況:it

chkconfig --list

如沒有,則添加到系統啓動隊列中:io

chkconfig --add frp

從新檢查frp開機啓動狀況,若成功,則應顯示以下內容:function

frp 0:off 1:off 2:on 3:on 4:on 5:on 6:offclass

 

使用下列命令對frp進行重啓、中止、啓動:service

service frp start
相關文章
相關標籤/搜索