Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
FRP systemd 启动脚本

My Version, Allow run as nobody AND ports below 1024

/etc/systemd/system/frps.service

[Unit]
Description=FRP Server Daemon

[Service]
Type=simple
ExecStartPre=-/usr/sbin/setcap cap_net_bind_service=+ep /opt/bin/frps
ExecStart=/opt/bin/frps -c /opt/etc/frps.ini
Restart=always
RestartSec=20s
User=nobody
PermissionsStartOnly=true
LimitNOFILE=infinity

[Install]
WantedBy=multi-user.target

/etc/systemd/system/frpc.service

[Unit]
Description=FRP Client Daemon
After=network.target
Wants=network.target

[Service]
Type=simple
ExecStart=/opt/bin/frpc -c /opt/etc/frpc.ini
Restart=always
RestartSec=20s
User=nobody
LimitNOFILE=infinity

[Install]
WantedBy=multi-user.target

Config

systemctl enable frpc
systemctl status frpc
systemctl enable frps
systemctl status frps
@ZHLHZHU

This comment has been minimized.

Copy link

ZHLHZHU commented Mar 5, 2019

frpc.service的ExecStart应该是/opt/bin/frpc

@archchen

This comment has been minimized.

Copy link

archchen commented Mar 14, 2019

应该放在/lib/systemd/system/目录下面
frpc最好使用@来支持多个客户端连接到不同的服务器
/lib/systemd/system/frpc@.service
[Unit]
Description=FRP Client Daemon
After=network.target
Wants=network.target

[Service]
Type=simple
ExecStart=/opt/bin/frpc -c /opt/etc/%i.ini
Restart=always
RestartSec=20s
User=nobody

[Install]
WantedBy=multi-user.target

@ihipop

This comment has been minimized.

Copy link
Owner Author

ihipop commented Jul 9, 2019

frpc.service的ExecStart应该是/opt/bin/frpc

已经修改

@sillydanny

This comment has been minimized.

Copy link

sillydanny commented Jul 13, 2019

很好, 我客戶端已經可以開機自啟動. 謝謝分享.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.