提示:適用于CentOS透乾、RedHat
1.編輯文件
vim /usr/lib/systemd/system/frp.service
添加以下內(nèi)容
[unit]
Description=Frp Clinet
After=multi-user.targe
[Service]
TimeoutStartSec=30
ExecStart=/usr/local/frp/frpc -c /usr/local/frp/frpc.ini
ExecStop=/bin/kill $MAINPID
Restart=on-failure
RestartSec=3s
[Install]
WantedBy=multi-user.target
注意:啟動參數(shù)指定程序路徑洪燥,根據(jù)實際情況修改;
或者
cat >> /usr/lib/systemd/system/frp.server << EOF
[unit]
Description=Frp Clinet
After=multi-user.targe
[Service]
TimeoutStartSec=30
ExecStart=/usr/local/frp/frpc -c /usr/local/frp/frpc.ini
ExecStop=/bin/kill \$MAINPID
Restart=on-failure
RestartSec=3s
[Install]
WantedBy=multi-user.target
EOF
2.刷新配置
systemctl daemon-reload
3.啟動服務(wù)
systemctl start frp
4.設(shè)置開機自動啟動
systemctl enable frp
5.查看服務(wù)狀態(tài)
systemctl status frp