#!/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