-
Notifications
You must be signed in to change notification settings - Fork 5
/
verify-on-completion.sh
executable file
·40 lines (33 loc) · 1.22 KB
/
verify-on-completion.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
# This script automatically verifies a torrent after
# it completes. All the heavy lifting is done by
# "transmission-verify-torrent", which you need to build
# and install (make && sudo make install).
# Uncomment for debugging
# TR_TORRENT_ID=$1
# Put the following code at the very top
# of your transmission completion script.
# Verify torrent data upon completion
# Usage: transmission-verify-torrent [host] torrent-id [options]
# Options:
# -n --auth <user:pw> Set username and password
# -ne --authenv Set authentication info from the
# TR_AUTH environment variable
status=`transmission-verify-torrent $TR_TORRENT_ID 2> verify-errors.out`
# Check if the torrent really is complete
if [ "$status" != "Complete" ]
then
if [ "$status" != "" ]
then
echo "Torrent is not complete."
echo "Status is $status."
else
echo "transmission-verify-torrent encountered errors:"
cat verify-errors.out
fi
# If the torrent is not complete, exit and this script will be called again on "completion"
exit
fi
echo "Torrent is $status."
# The torrent really is complete now
# Put the rest of your completion script after this