wiki:Scripts/BlockListUpdater

Block List Updater Script

(for other scripts, see the Scripts page)

NOTICE

Functionality of this script has been implemented in libtransmission which makes this script (partially) obsolete. transmission-remote does not yet have the ability to trigger the blocklist update, a ticket is open at #2786.

Notes

If you start the daemon with arguments, either read how to modify the configuration file or change the last line.
If you have the configuration files at a non standard location, you'll need to modify the cd $HOME/.config/transmission-daemon/blocklists/ line near the end.

Script

#!/bin/sh

PID="`pidof transmission-daemon`"
if [ -n "$PID" ]; then
        kill $PID
fi

echo -n "Waiting for the daemon to exit "
sleep 2

COUNT=1
while [ -n "`pidof transmission-daemon`" ]; do
        COUNT=$((COUNT + 1))
        if [ $COUNT -gt 60 ]; then
                echo -n "transmission-daemon doesn't respond, killing it with -9"
                kill -9 `pidof transmission-daemon`
                break
        fi

        sleep 2
        echo -n "."
done

echo " done"

cd $HOME/.config/transmission-daemon/blocklists/
if wget http://www.bluetack.co.uk/config/level1.gz 1>/dev/null 2>&1 ; then
        rm -f level1 && gunzip level1.gz
        echo "blocklist updated"
else
        echo "blocklist not updated"
fi

transmission-daemon
Last modified 8 years ago Last modified on Jan 22, 2010, 12:01:57 PM