无聊发的慌搞得玩意。。。

每月服务器的流量剩余有点多,想办法消耗掉一点。。于是就有了这个玩意。。。。。

实现功能:循环下载一个URL上的文件N次到/dev/null(不写入硬盘,不伤硬盘,对电脑无损害)

支持系统Linux,macOS(已测试)

将下面代码文件保存为download.sh,并赋予执行权限即可使用。

#!/bin/bash

# Function to download the file with socks5 proxy and discard the output
download_file_to_null_with_proxy() {
  curl -x socks5h://127.0.0.1:2080 -s -o /dev/null "$1"
}

# Number of times to download the file
DOWNLOAD_COUNT=100

# URL of the file to download
DOWNLOAD_URL="https://speed.cloudflare.com/__down?bytes=1000000000"

# Loop to download the file 100 times with proxy
for ((i=1; i<=${DOWNLOAD_COUNT}; i++)); do
  echo "Downloading file ${i}/${DOWNLOAD_COUNT}..."
  download_file_to_null_with_proxy "${DOWNLOAD_URL}"
done

echo "Download completed!"