Solved my own problem! :hack: here is what I came up with.
1) Install the Safari downloader hack, which allows download of files to /var/mobile/Library/Downloads.
2) Set up a launchd plist file at /Library/LaunchDaemons/com.automation.torrentmover.plist
3) Create the script /var/mobile/torrentmover.sh
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
Make that script executable with chmod +x. I have this file owned by root, I don't think it worked when owned by mobile.
/bin/echo "START" >> /var/log/torrentmover
/bin/echo "Change detected in $DIR" >> $LOG
for f in $FILELIST
echo " Checking $DIR/$f" >> $LOG
file $DIR/$f | grep -i bittorrent 2>&1 > /dev/null
if [ $IS_TORRENT -eq 0 ]; then
echo " Torrent file detected" >> $LOG
scp $DIR/$f $DEST 2>&1 >> $LOG
if [ $SUCCESS -eq 0 ]; then
echo " File sent, removing" >> $LOG
4) Install the launchd job:
launchctl load /Library/LaunchDaemons/com.automation.torrentmover.plist
Now try downloading a .torrent file from mobile Safari, and it should get sent to the destination folder on your server, where you have Transmission or some other torrent client watching the dir for new torrents.
NB I rename the files to iPhone_<date>.torrent because on some torrent sites I would end up with a file called torrent.php. That's why I use 'file' to determine if a file is BitTorrent.
Hope this helps someone else, please let me know your thoughts.