Skip to content

Instantly share code, notes, and snippets.

@luckylittle
Last active March 20, 2025 23:36
Show Gist options
  • Save luckylittle/80f343221636bdb68fc8cc2e274752c6 to your computer and use it in GitHub Desktop.
Save luckylittle/80f343221636bdb68fc8cc2e274752c6 to your computer and use it in GitHub Desktop.
Bash script to backup the main settings & filters from autobrr (until proper db backup exists)
[Unit]
Description=autobrr service for %i
After=syslog.target network-online.target
[Service]
Type=simple
User=%i
Group=%i
ExecStart=/usr/local/bin/autobrr --config=/home/%i/.config/autobrr/
[Install]
WantedBy=multi-user.target
#!/bin/zsh
export AUTOBRR_HOST="127.0.0.1"
export AUTOBRR_API_KEY="abcdefghijklmnopqrstuvwxyz"
# Backup indexers
curl -X GET "http://${AUTOBRR_HOST}:7474/api/indexer" -H "X-API-Token: ${AUTOBRR_API_KEY}" | jq > autobrr_indexers$(date +%Y%m%d).json
# Backup IRCs
curl -X GET "http://${AUTOBRR_HOST}:7474/api/irc" -H "X-API-Token: ${AUTOBRR_API_KEY}" | jq > autobrr_ircs$(date +%Y%m%d).json
# Backup RSS Feeds
curl -X GET "http://${AUTOBRR_HOST}:7474/api/feeds" -H "X-API-Token: ${AUTOBRR_API_KEY}" | jq > autobrr_feeds$(date +%Y%m%d).json
# Backup filters
ids=$(curl -X GET "http://${AUTOBRR_HOST}:7474/api/filters" -H "X-API-Token: ${AUTOBRR_API_KEY}" | jq -r '.[].id')
while read -r id; do
name=$(curl -X GET "http://${AUTOBRR_HOST}:7474/api/filters/${id}" -H "X-API-Token: ${AUTOBRR_API_KEY}" | jq -r '.name')
curl -X GET "http://${AUTOBRR_HOST}:7474/api/filters/${id}" -H "X-API-Token: ${AUTOBRR_API_KEY}" | jq > autobrr_filter_${name}$(date +%Y%m%d).json
done <<< "$ids"
#!/bin/bash
################################
export AUTOBRR_VERSION="1.60.0"
################################
wget https://github.com/autobrr/autobrr/releases/download/v${AUTOBRR_VERSION}/autobrr_${AUTOBRR_VERSION}_linux_x86_64.tar.gz
tar xvzf autobrr_${AUTOBRR_VERSION}_linux_x86_64.tar.gz
sudo systemctl stop [email protected]
sudo mv -v autobrr autobrrctl /usr/local/bin/
sudo restorecon -Rv /usr/local/bin/
export AUTOBRR_CURRENT_VERSION=$(autobrrctl version | grep 'Version: ' | cut -d ' ' -f 2)
echo "${AUTOBRR_CURRENT_VERSION}" > ~/.config/autobrr/.current_version
tar cvzf autobrr_backup_$(date +%Y-%m-%d_%H%M%S).tgz ~/.config/autobrr
sudo systemctl start [email protected]
sudo systemctl is-active [email protected]
rm -vf autobrr_${AUTOBRR_VERSION}_linux_x86_64.tar.gz LICENSE README.md
mv -v autobrr_backup_$(date +%Y-%m-%d_%H%M%S).tgz ~/site/UPLOAD/
echo "Upgrade of autobrr to version ${AUTOBRR_VERSION} finished!"
@luckylittle
Copy link
Author

Example - To add except_release_groups to all filters:

ids=$(curl -X GET "http://${AUTOBRR_HOST}:7474/api/filters" -H "X-API-Token: ${AUTOBRR_API_KEY}" | jq -r '.[].id')
while read -r id; do
  curl -X PATCH "http://${AUTOBRR_HOST}:7474/api/filters/${id}" -H "X-API-Token: ${AUTOBRR_API_KEY}" -d '{"except_release_groups":"PlayWEB,FLUX,NTb,MeGusta,d3g,LAMA,T0PAZ,ELiTE,FENiX,AOC,PiRaTeS,LEGi0N,CtrlHD,FraMeSToR,OFT"}'
done <<< "$ids"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment