Skip to content

Instantly share code, notes, and snippets.

@bindog
Forked from ihipop/frp systemd.md
Created August 3, 2020 09:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bindog/061b6ae8df303f228588eb4987d819ca to your computer and use it in GitHub Desktop.
Save bindog/061b6ae8df303f228588eb4987d819ca to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment