[HowTo] Mass change tracker announce with sed command

General support for problems installing or using Deluge
Post Reply
Compulsive Poster
Compulsive Poster
Posts: 656
Joined: Sat Oct 08, 2016 9:28 am

[HowTo] Mass change tracker announce with sed command

Post by shamael »

Hi all,

You want to change the tracker URL or Passkey for all torrents of a tracker? Below the method I applied. The commands are based on a setup matching http://dev.deluge-torrent.org/wiki/User ... ce/systemd, adapts to your setup if needed. The example shows a tracker URL change but the passkey can be changed by the same method

OLD_TRACKER_URL and NEW_TRACKER_URL represent variable you have to change depending your tracker

#logon and elevate to root
sudo bash

#go to the Deluge"s profile folder
cd /var/lib/deluge/.config/

#stop Deluge service (here the daemon+web)
systemctl stop deluged deluge-web

#backup the profile
cp -r deluge deluge.old

#The setup runs with user "deluge", take back the ownership of folder deluge.old
chown -R deluge:deluge deluge.old

#go to the torrents.state location
cd deluge/state

#[Optional: count the number of torrent with old tracker URL (or passkey)]
cat torrents.state|grep -ic OLD_TRACKER_URL

#change the tracker URL to the new one
sed -i 's#OLD_TRACKER_URL#NEW_TRACKER_URL#g' torrents.state

#[Optional: check the number of file is the same as prior one]
cat torrents.state|grep -ic NEW_TRACKER_URL

#restart daemons
systemctl start deluged deluge-web
Post Reply