Your cart is currently empty!
Keeping FRP Up to Date with a One-Line Script

The Script
Save the following as /usr/local/bin/frp-update
and make it executable with chmod +x /usr/local/bin/frp-update
.
#!/usr/bin/env bash
# frp-update <arch>
# Example:
# sudo frp-update linux_amd64
set -euo pipefail
IFS=$'\n\t'
[[ $EUID -ne 0 ]] && { echo "Run as root (sudo)." >&2; exit 2; }
[[ $# -lt 1 ]] && { echo "Usage: $0 <arch>" >&2; exit 1; }
ARCH=$1
ROOT_HOME="/root"
INSTALL_DIR="/usr/local/bin"
log() { echo "[$(date -u +'%F %T')] $*"; }
# --- Get latest release tag ---
release_json="$ROOT_HOME/frp-release.json"
curl -fsSL "https://api.github.com/repos/fatedier/frp/releases/latest" -o "$release_json"
TAG=$(grep -m1 '"tag_name":' "$release_json" | sed -E 's/.*"v?([^"]+)".*/\1/')
ASSET_URL=$(grep "browser_download_url" "$release_json" | grep "$ARCH" | head -n1 | cut -d '"' -f 4)
[[ -z "$ASSET_URL" ]] && { echo "No asset for arch '$ARCH' found."; exit 3; }
# --- Check current version (frpc first, then frps) ---
CURRENT=""
if [[ -x "$INSTALL_DIR/frpc" ]]; then
CURRENT=$($INSTALL_DIR/frpc --version 2>/dev/null | grep -oE '[0-9]+\.[0-9]+\.[0-9]+') || true
fi
if [[ -z "$CURRENT" && -x "$INSTALL_DIR/frps" ]]; then
CURRENT=$($INSTALL_DIR/frps --version 2>/dev/null | grep -oE '[0-9]+\.[0-9]+\.[0-9]+') || true
fi
if [[ -n "$CURRENT" && "$CURRENT" == "$TAG" ]]; then
log "No update found (already at $CURRENT)"
rm -f "$release_json"
exit 0
fi
log "Update available: current=${CURRENT:-none} latest=$TAG"
# --- Download + extract ---
ARCHIVE="$ROOT_HOME/$(basename "$ASSET_URL")"
EXTRACT_DIR="$ROOT_HOME/frp_${TAG}_$ARCH"
log "Downloading $ASSET_URL"
curl -fsSL "$ASSET_URL" -o "$ARCHIVE"
log "Extracting $ARCHIVE"
mkdir -p "$EXTRACT_DIR"
tar -C "$EXTRACT_DIR" -xzf "$ARCHIVE"
for bin in frpc frps; do
path=$(find "$EXTRACT_DIR" -type f -name "$bin" | head -n1 || true)
[[ -z "$path" ]] && continue
install -m 0755 "$path" "$INSTALL_DIR/$bin"
log "Updated $bin -> $INSTALL_DIR/$bin"
done
# --- Cleanup ---
rm -f "$ARCHIVE" "$release_json"
rm -rf "$EXTRACT_DIR"
log "Update complete to version $TAG"
Usage
Check and update FRP binaries for Linux AMD64:
sudo frp-update linux_amd64
Check for ARM64 (e.g., Raspberry Pi):
sudo frp-update linux_arm64
If the installed version matches the latest GitHub release, you’ll see:
[2025-09-30 12:34:56] No update found (already at 0.65.0)
Otherwise, it will fetch, install, and overwrite /usr/local/bin/frpc
and /usr/local/bin/frps
.
Notes
- Running services keep using the old binary until you restart them. Overwriting doesn’t break currently running
frpc
/frps
. - Restart your systemd units when it’s convenient:
sudo systemctl restart frpc@vps1 frpc@vps2
sudo systemctl restart frps
If you want to automate it, hook the script into a cron job or a systemd timer.
Leave a Reply