/share/Rdownload/sh-script/_event.download.finished
#!/bin/sh
# rTorrent event script handler
#
# Script launcher. DO NOT MODIFY!
#
# Usage:
# a) In the directory: /share/Rdownload/sh-script
# create file named: finished-*.sh
#
# (eg. finished-sendmail.sh)
#
# b) set executables permissions:
# # chmod a+x -R /share/Rdownload/sh-script/*.sh
#
DIR="/share/Rdownload/sh-script"
FILES="${DIR}/finished*.sh"
if [ ! -d "$DIR" ]; then
echo "Directory $DIR not exist."
exit 0
fi
if [ -z "$3" ]; then
cat <<-EOF
Missing arguments. Syntax:
# $(basename $0) <hash> <name> <path> [label]
Arguments:
hash - torrent infohash
name - torrent name
path - torrent data path
Optional arguments:
label - torrent label
EOF
exit 0
fi
# Call custom handler scripts
for i in $FILES
do
echo Execute: $i $@
test ! -x "$i" || "$i" "$@" >> $DIR/log
done
# important status exit otherwise will break other executions
exit 0
/share/Rdownload/sh-script/_event.download.finished
./share/Rdownload/sh-script/
file: finished-example.sh
#!/bin/sh
echo "Hello from $(basename $0) $@"
exit 0
$1
- torrent hash$2
- torrent name $3
- torrent path$4
- torrent labelchmod a+x /share/Rdownload/sh-script/finished-example.sh