Skip to content

Instantly share code, notes, and snippets.

@luckylittle
Created February 18, 2026 01:20
Show Gist options
  • Select an option

  • Save luckylittle/897bc025adca4b39c0bfee7a6460ce06 to your computer and use it in GitHub Desktop.

Select an option

Save luckylittle/897bc025adca4b39c0bfee7a6460ce06 to your computer and use it in GitHub Desktop.
In case of IO disk overload and WebUI not accessible, pause all currently active torrents in qBittorrent via shell script
#!/bin/bash
# Tested on:
# qBit v5.1.4 | API v2.11.4 | lt 2.0.11.0
QBT="http://127.0.0.1:8080"
TIMEOUT="300"
# Get JSON from API and extract hashes of all currently active torrents
hashes=$(/usr/bin/curl --connect-timeout ${TIMEOUT} "${QBT}/api/v2/torrents/info?filter=active" | jq -r '.[].hash' | paste -sd '|' -)
[[ -z "${hashes}" ]] && { echo "Hashes is empty!" ; exit 1; }
# Optional: print hashes for verification
echo "Hashes: ${hashes}"
# Call pause API with hashes
/usr/bin/curl -X POST --connect-timeout ${TIMEOUT} "${QBT}/api/v2/torrents/stop" --data-raw "hashes=${hashes}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment