# How to Update Proxy Subscriptions Automatically in the Fanqiang Repository

> Automatically update proxy subscriptions in the bannedbook fanqiang repository using client auto-refresh features or OS schedulers. Keep your connections current effortlessly.

- Repository: [如何翻墙/fanqiang](https://github.com/bannedbook/fanqiang)
- Tags: how-to-guide
- Published: 2026-09-06

---

**The Fanqiang repository enables automatic proxy subscription updates through built-in client auto-refresh features in V2rayX, V2RayN, and Clash clients, or alternatively via OS-level schedulers like cron and Windows Task Scheduler.**

The `bannedbook/fanqiang` repository provides comprehensive proxy client configurations and tutorials across macOS, Windows, Linux, Android, and iOS platforms. A **subscription URL** serves as the central mechanism for distributing proxy node lists—this single link returns a JSON or YAML payload that clients parse to populate their server configurations.

## Built-In Client Auto-Refresh (Recommended Method)

Most modern proxy clients documented in the Fanqiang repository include native subscription auto-update functionality. This is the most reliable approach because clients handle parsing, validation, and hot-reloading automatically.

### macOS: V2rayX Auto-Update Configuration

The V2rayX documentation in [`macos/V2rayX.md`](https://github.com/bannedbook/fanqiang/blob/main/macos/V2rayX.md) describes the subscription workflow:

1. Open V2rayX → **Settings** → **Subscription** panel.
2. Paste your subscription URL into the designated input field.
3. **Critical step**: Click a blank area of the window to confirm the entry—this registers the change in the UI.
4. Enable **Auto-Update** and specify an interval (commonly 6 hours).
5. Save settings.

V2rayX will then fetch and parse the subscription silently in the background. The manual "Update subscription" button remains available for on-demand refreshes.

### Windows: V2RayN Auto-Update Configuration

Per [`windows/V2RayN.md`](https://github.com/bannedbook/fanqiang/blob/main/windows/V2RayN.md), the Windows client follows an identical pattern:

- Navigate to **Settings** → **Subscription**
- Enter subscription URL, check **Enable Auto-Update**, select interval
- The client handles subsequent fetches automatically

### Linux: Clash and Other Clients

Linux variants documented in the repository (Clash, ClashX counterparts) typically expose subscription settings through their respective configuration files or GUI panels, with the same core parameters: URL, refresh interval, and auto-enable toggle.

## OS-Level Scheduler Method (Fallback)

When client auto-refresh is unavailable or you need custom processing, use operating system schedulers. The repository's [`gitupdate.sh`](https://github.com/bannedbook/fanqiang/blob/main/gitupdate.sh) and `gitupdate.bat` scripts demonstrate the pattern for periodic command execution.

### macOS/Linux: Cron-Based Subscription Update

Create [`update_proxy_sub.sh`](https://github.com/bannedbook/fanqiang/blob/main/update_proxy_sub.sh):

```bash
#!/usr/bin/env bash

# Update proxy subscription via cron

# Reference: gitupdate.sh pattern from bannedbook/fanqiang

SUB_URL="${PROXY_SUB_URL:-https://example.com/your-subscription}"
CONFIG_DIR="${HOME}/.config/v2rayx"
CONFIG_PATH="${CONFIG_DIR}/subscription.json"

# Ensure directory exists

mkdir -p "${CONFIG_DIR}"

# Fetch subscription with curl

curl -fsSL \
  --connect-timeout 10 \
  --max-time 30 \
  -H "User-Agent: V2rayX/1.0" \
  "${SUB_URL}" \
  -o "${CONFIG_PATH}.tmp"

# Atomic replacement on success

if [ -s "${CONFIG_PATH}.tmp" ]; then
  mv "${CONFIG_PATH}.tmp" "${CONFIG_PATH}"
  logger -t proxy-update "Subscription updated: ${CONFIG_PATH}"
else
  logger -t proxy-update "Subscription fetch failed"
  rm -f "${CONFIG_PATH}.tmp"
  exit 1
fi

```

Make executable and schedule:

```bash
chmod +x update_proxy_sub.sh
crontab -e

```

Add entry for 6-hour intervals:

```cron
0 */6 * * * /path/to/update_proxy_sub.sh >/dev/null 2>&1

```

### Windows: Task Scheduler with Batch Script

Adapt `gitupdate.bat` for subscription updates. Create `update_proxy_sub.bat`:

```batch
@echo off
setlocal enabledelayedexpansion

:: Proxy subscription auto-update for Windows
:: Pattern derived from gitupdate.bat in bannedbook/fanqiang

set "SUB_URL=https://example.com/your-subscription"
set "CONFIG_DIR=%USERPROFILE%\AppData\Roaming\V2RayN"
set "CONFIG_PATH=%CONFIG_DIR%\subscription.json"

if not exist "%CONFIG_DIR%" mkdir "%CONFIG_DIR%"

curl.exe -fsSL ^
  --connect-timeout 10 ^
  --max-time 30 ^
  -H "User-Agent: V2RayN/1.0" ^
  "%SUB_URL%" ^
  -o "%CONFIG_PATH%.tmp"

if %ERRORLEVEL% EQU 0 (
    if exist "%CONFIG_PATH%.tmp" (
        move /Y "%CONFIG_PATH%.tmp" "%CONFIG_PATH%" >nul
        echo [%date% %time%] Subscription updated >> "%CONFIG_DIR%\update.log"
    )
) else (
    echo [%date% %time%] Subscription fetch failed >> "%CONFIG_DIR%\update.log"
    del /Q "%CONFIG_PATH%.tmp" 2>nul
    exit /b 1
)

```

Configure Task Scheduler:
- **Trigger**: Daily, repeat every 6 hours
- **Action**: Start program → `update_proxy_sub.bat`
- **Conditions**: Run whether user is logged on or not (with appropriate permissions)

## Key Source Files in bannedbook/fanqiang

| File Path | Purpose |
|-----------|---------|
| [`macos/V2rayX.md`](https://github.com/bannedbook/fanqiang/blob/main/macos/V2rayX.md) | Complete V2rayX setup including subscription URL entry and manual/auto update instructions |
| [`windows/V2RayN.md`](https://github.com/bannedbook/fanqiang/blob/main/windows/V2RayN.md) | V2RayN Windows client guide covering subscription configuration |
| [`gitupdate.sh`](https://github.com/bannedbook/fanqiang/blob/main/gitupdate.sh) | Shell script template demonstrating periodic command execution for automation |
| `gitupdate.bat` | Windows batch template for scheduled task automation |
| [`README.md`](https://github.com/bannedbook/fanqiang/blob/main/README.md) | Primary index linking to all platform-specific guides |

## Platform-Specific Client References

The repository organizes clients by operating system with dedicated markdown files:

- **macOS**: V2rayX.md, V2rayU.md, ClashX.md
- **Windows**: V2RayN.md, ShadowsocksR.md
- **Linux**: Distribution-specific V2Ray guides
- **Mobile**: Android and iOS client documentation

Each guide addresses subscription URL input and update mechanisms where applicable.

## Summary

- **Built-in auto-refresh** is the preferred method—configure subscription URL and interval directly in V2rayX, V2RayN, or Clash clients as documented in their respective `.md` files
- **Cron-based scripts** provide Linux/macOS automation with precise control over fetch behavior, logging, and error handling
- **Windows Task Scheduler** with adapted `.bat` scripts achieves equivalent automation, following patterns from `gitupdate.bat`
- **Atomic file operations** (write to temp, then move) prevent configuration corruption during concurrent client access

## Frequently Asked Questions

### How often should I set the subscription refresh interval?

Six hours strikes a practical balance for most users. More frequent updates increase server load and may trigger rate limits; less frequent updates risk using stale or offline nodes. Adjust based on your provider's documented rotation frequency.

### What happens if the subscription fetch fails?

Robust clients retry on next interval. For script-based approaches, implement atomic writes (temp file then move) and log failures for monitoring. The examples above include basic error handling—production deployments should add alerting for consecutive failures.

### Can I use multiple subscription URLs simultaneously?

Most modern clients support multiple subscription entries. Check your specific client's documentation: V2rayX and V2RayN typically allow several URLs with independent refresh intervals. For script-based solutions, run separate update scripts per URL with distinct output paths.

### Does automatic subscription update require keeping the client GUI open?

Client-dependent. V2rayX and V2RayN generally run background services that persist after GUI closure. Verify with your specific version—linux daemon-mode clients and Windows services handle this most reliably.