Watch dir only looked at on daemon start

Ask for help and report issues not specific to either the Mac OS X or GTK+ versions of Transmission
Post Reply
tylojuky
Posts: 4
Joined: Fri Dec 17, 2010 1:54 am

Watch dir only looked at on daemon start

Post by tylojuky »

Sorry if this has already been addressed. I searched this and several other forums and found "similar" posts but nothing quite like this.

My installation is on Ubuntu 9.10
I am running transmission-daemon 2.12 installed from "http://ppa.launchpad.net/transmissionbt/ppa/ubuntu karmic main" (also have the transmission-gtk installed).

I can't seem to get new torrents to be picked up automatically while the transmission-daemon is running.
If there are torrent files in the watch folder when transmission-daemon is started, then they ARE picked up.

More detail:
While transmission-daemon is running (whether or not there are active torrents), I drop a torrent file in the watch directory - nothing happens (for hours).
If I stop & start or "restart" the daemon, or if I reboot, then the new torrent file is picked up, renamed to ...torrent.added, download begins, etc.
As a test, I stopped the daemon and started the gui (gtk). When the gui is running and I drop a torrent file in the watch directory, it IS picked up automatically (nearly instantaneously).
In other words, everything is working fine except dropping a new torrent in the watch folder WHILE the daemon is running.

Has anyone else experienced this? Any ideas what I should look at to diagnose?

Thanks

Just for reference, here's my settings.json file:
{
"alt-speed-down": 100,
"alt-speed-enabled": false,
"alt-speed-time-begin": 540,
"alt-speed-time-day": 127,
"alt-speed-time-enabled": false,
"alt-speed-time-end": 930,
"alt-speed-up": 10,
"bind-address-ipv4": "0.0.0.0",
"bind-address-ipv6": "::",
"blocklist-date": 1292295588,
"blocklist-enabled": true,
"blocklist-updates-enabled": true,
"blocklist-url": "http://update.transmissionbt.com/level1.gz",
"cache-size-mb": 2,
"compact-view": false,
"dht-enabled": true,
"download-dir": "/mnt/NASDownloads/Torrent Downloads",
"encryption": 2,
"idle-seeding-limit": 30,
"idle-seeding-limit-enabled": false,
"incomplete-dir": "/mnt/NASDownloads/Torrent Downloads",
"incomplete-dir-enabled": false,
"inhibit-desktop-hibernation": true,
"lazy-bitfield-enabled": true,
"lpd-enabled": false,
"main-window-height": 538,
"main-window-is-maximized": 0,
"main-window-width": 920,
"main-window-x": 28,
"main-window-y": 84,
"message-level": 2,
"open-dialog-dir": "/home/kyle",
"open-file-limit": 32,
"peer-limit-global": 240,
"peer-limit-per-torrent": 60,
"peer-port": 51413,
"peer-port-random-high": 65535,
"peer-port-random-low": 49152,
"peer-port-random-on-start": false,
"peer-socket-tos": 0,
"pex-enabled": true,
"play-download-complete-sound": false,
"port-forwarding-enabled": true,
"preallocation": 1,
"prompt-before-exit": true,
"ratio-limit": 2,
"ratio-limit-enabled": true,
"rename-partial-files": true,
"rpc-authentication-required": false,
"rpc-bind-address": "0.0.0.0",
"rpc-enabled": true,
"rpc-password": "{ac82cc172ae0fc0f3090f29975e44134cd322be4C254qo7P",
"rpc-port": 9090,
"rpc-username": "",
"rpc-whitelist": "127.0.0.1,192.168.2.*",
"rpc-whitelist-enabled": true,
"script-torrent-done-enabled": false,
"script-torrent-done-filename": "/home/kyle",
"show-backup-trackers": false,
"show-desktop-notification": false,
"show-extra-peer-details": false,
"show-filterbar": true,
"show-notification-area-icon": false,
"show-options-window": false,
"show-statusbar": true,
"show-toolbar": true,
"show-tracker-scrapes": false,
"sort-mode": "sort-by-name",
"sort-reversed": false,
"speed-limit-down": 400,
"speed-limit-down-enabled": true,
"speed-limit-up": 30,
"speed-limit-up-enabled": true,
"start-added-torrents": true,
"statusbar-stats": "total-ratio",
"trash-original-torrent-files": false,
"umask": 18,
"upload-slots-per-torrent": 14,
"user-has-given-informed-consent": true,
"watch-dir": "/mnt/NASDownloads/Torrent Files",
"watch-dir-enabled": true
}
Rolcol
Posts: 337
Joined: Sun Aug 10, 2008 8:00 am

Re: Watch dir only looked at on daemon start

Post by Rolcol »

Is the watch directory a network folder? If so, your system may not be updating the directory unless an application has opened it, which transmission-daemon does on start. Have you tried using a different folder that is on the same filesystem as the daemon?
lakrigg
Posts: 17
Joined: Fri Dec 31, 2010 7:32 am

Re: Watch dir only looked at on daemon start

Post by lakrigg »

Use this if your stuck

make a new file script

nano /root/torrentwatch.sh

paste the folllowing text then save (change the /volum1/torrentwatch/ to the path of your folder

#!/bin/bash

for file in /volume1/torrentwatch/*.torrent

do
if [ "$file" != "/volume1/torrentwatch/*.torrent" ]; then
echo [`date`] "$file" added to queue. >> /var/log/toradd.log
/opt/bin/transmission-remote -a "$file"
rm "$file"
sleep 1
fi
done



Save the file then run
chmod a+x /root/torrentwatch.sh
nano /etc/crontab

paste this next line then save

* * * * * root sh /root/torrentwatch.sh

now run
crond restart

This will add each .torrent file u drop in that directory.
tylojuky
Posts: 4
Joined: Fri Dec 17, 2010 1:54 am

Re: Watch dir only looked at on daemon start

Post by tylojuky »

Rolcol, I think you may be onto something. The folder being watched is on a NAS. Also, I happened to be logged into the machine that's running Transmission the other day and I dropped a torrent file into that folder while I was on that machine. Transmission picked those up within a couple seconds. So, something's triggering Transmission some of the time but it must not be doing a "sweep" or anything comprehensive like that. I'll move the folder to a location on the local files system where Transmission is running (then I'll have to share that for the rest of the clients on the network) and give that a try.
tylojuky
Posts: 4
Joined: Fri Dec 17, 2010 1:54 am

Re: Watch dir only looked at on daemon start

Post by tylojuky »

I gave up on plan A. Samba's not installed on that machine (and I hate setting that up), every share on my network is on my NAS box, I'm lazy, whatever. I moved on to plan B.

Lakrigg,
Thanks a ton for the script. That got me going.

I made a few changes:
- I don't run transmission-daemon on the default port
- transmission-remote was installed at /usr/bin for me (Ubuntu 9.10)
- I rename my torrent files to .added instead of deleting them
Other than that, it's your script and it got me going a lot quicker than trying to write that on my own from scratch. Thanks again.

For anyone interested, my script looks like this:

Code: Select all

#!/bin/bash

for file in /mnt/NASDownloads/TorrentFiles/*.torrent

do
if [ "$file" != "/mnt/NASDownloads/TorrentFiles/*.torrent" ]; then
echo [`date`] "$file" added to queue. >> /var/log/torrentwatch.log
/usr/bin/transmission-remote localhost:9090 -a "$file"
mv "$file" "$file".added
sleep 1
fi
done
lakrigg
Posts: 17
Joined: Fri Dec 31, 2010 7:32 am

Re: Watch dir only looked at on daemon start

Post by lakrigg »

good to hear it helped ya.

Yeh was designed for my MyBookWorld NAS ect. Sounds like you made some improvements.

I managed to fix my transmission lockups by adding the prefix EVENT_NOEPOLL='0' to my startup script. Was plaguing me for months before today when turned out it was a NAS thing.

Sometimes it's just easier to cut corners :P
Dropbear67
Posts: 3
Joined: Wed Feb 02, 2011 12:08 am

Re: Watch dir only looked at on daemon start

Post by Dropbear67 »

I wonder if my problem

viewtopic.php?f=2&t=11213


is related to this... I have my watch-dir to a local directory, but that directory is shared and written to by a windows client via CIFS (solaris)
tylojuky
Posts: 4
Joined: Fri Dec 17, 2010 1:54 am

Re: Watch dir only looked at on daemon start

Post by tylojuky »

Same thing was happening to me. Different OS's but same behavior: If I copied a torrent to the watch directory using the machine where Transmission was running, it worked. If I copied a file to that directory from another machine, it didn't work. My solution was to implement the shell script via cron job as described above.
kurh
Posts: 1
Joined: Wed Jan 09, 2013 5:46 am

Re: Watch dir only looked at on daemon start

Post by kurh »

hello.
ask for help from you.
I have raspberry pi.I have it set up with transmission. everything works fine except for one
When run, it takes the files fromwatch-dir and adding a new torrent file.
and when i add a new file that does not occur

"watch-dir": "/ opt / ya / tor",
"watch-dir-enabled": true.

Folder watc-dir synchronized with the cloud storage
I wanted to add a squeak, but found
/ var / log / toradd.log/
opt / bin / transmission-remote-a
is all empty
help please.
PS translated into Google translator, sorry for the mistakes
Jordan
Transmission Developer
Posts: 2312
Joined: Sat May 26, 2007 3:39 pm
Location: Titania's Room

Re: Watch dir only looked at on daemon start

Post by Jordan »

Do you really have the spaces in the directory setting? It should be something like "/opt/ya/tor", not "/ opt / ya / tor"
caldwelljt
Posts: 1
Joined: Tue Jan 06, 2015 5:38 am

Re: Watch dir only looked at on daemon start

Post by caldwelljt »

I thank you so very much for the help. I had this same issue combined with other issues and found this to be the simplest way to fix it.

In my case, I am using the Tretflix appliance first on CIFS then on NFS, both pointing at a windowz box on NTFS... This drove me nuts, but after testing adding with transmission-remote from the command line (i had to add auth and hide the password in the config, but i don't use this password for anything else).

So, yes, I created an account just to say thanks!

Oh, btw... The captcha was umm... hard for me to do, i had to try it a number of times because I'm so horribly color (or colour) blind... :lol:

fwiw, here is my script. I didn't change much but add the auth and had it move instead of delete the torrents. I also adjusted for different binary locations.

----- /root/torrentwatch.sh -----
#!/bin/bash

for file in \/mnt\/192.168.1.12\/m\/media\/video\/tor\/*.torrent

do
if [ "$file" != "\/mnt\/192.168.1.12\/m\/media\/video\/tor\/*.torrent" ]; then
echo [`date`] "$file" added to queue. >> /var/log/toradd.log
/usr/bin/transmission-remote -n admin:password -a "$file"
mv "$file" \/mnt\/192.168.1.12\/m\/media\/video\/tor\/loaded\/.
sleep 1
fi
done
--------------------------------------------

Thanks again!
getupson
Posts: 1
Joined: Mon Feb 16, 2015 5:34 am

Re: Watch dir only looked at on daemon start

Post by getupson »

First, thanks for the solution.

Second, here's an improvement/simplification (I think). Since this just a matter of the an un update not being triggered by the filesystem because the file was added by CIFS, a simple "touch" of the .torrent files suffices. I think this is better because it lets the Transmission scripts do their job as they were intended, and no need for running extra Transmission commands or storing passwords. My adapted solution (tested working for me):

Didn't bother with any logging. Don't care.

=========
#!/bin/bash

for file in /mnt/somepath/transmission/watch/*.torrent

do
if [ "$file" != "/mnt/somepath/transmission/watch/*.torrent" ]; then
touch "$file"
sleep 1
fi
done
=========

Same crontab entry (via "crontab -e" in Ubuntu):

* * * * * /home/user/torrentwatch.sh

My issue/setup was similar until this thread provided a solution: Transmission running in Ubuntu with watch and download dirs on NAS via NFS. Windows machine writes .torrent to watch via CIFS. Torrents were not automatically added. Now the "touch" updates the file access time and apparently that's enough to trigger whatever notification Transmission is looking for.

And yes, created account just to post this. And yes, the captcha is annoying.

EDIT: For anyone who skips all the way down, part of the solution is enabling the "watch" function in settings.json as in the last two config lines posted by OP.

EDIT 2: Fixed the script by putting "" around file in the touch command. Without that .torrent files with spaced i nthe name failed.
mailliw
Posts: 2
Joined: Tue Mar 10, 2015 4:44 pm

Re: Watch dir only looked at on daemon start

Post by mailliw »

Hi,

Just wanted to offer another solution. The "touch" method/script was good, but caused a few problems (it was creating a file called "*.torrent" when the directory was empty). So instead, I created a new directory and set a cronjob to check the existing directory, NewTorrentsHere, and move them into the temporary watch directory. This mv corrected any permissions issues and it's been working fine ever since.

Code: Select all

*/1 * * * * mv /home/pi/nas/NewTorrentsHere/*.torrent /home/pi/nas/Watch
/Watch is obviously the watch folder for Transmission. Hope this helps someone.
Post Reply