Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

On Debian Squeeze, I'd like for ctorrent to automatically open in a screen session if a new torrent file is placed in a particular folder (/home/torrent). Is there an easy way to, in a script, watch for new files being added to a folder and react to this change?

share|improve this question
1  
Just a though, but why not start a screen session and leave bittornado running in it. With the btlaunchmanycurses.bittornado you just point it at a directory. When new .torrent files are added, it starts automatically. –  Zoredache Nov 4 '12 at 21:18
    
@Zoredache Though it's too specific to be useful to the rest of the community as an answer, I like this idea and ultimately have decided upon going with this solution. –  Suchipi Nov 4 '12 at 22:03

3 Answers 3

up vote 2 down vote accepted

You should check out inotify-wait, that’s exactly what you need:

https://github.com/rvoicilas/inotify-tools/wiki

share|improve this answer

You can write a bash script with the combinations of "ls" and "find" command to determine if the folder has new torrent files. And then run the script periodically with cron.

Alternatively you can use rTorrent or Transmission-cli. Both has the built in feature to watch a directory for torrent files.

share|improve this answer

You may want to use incron, from the description:

incron is an "inotify cron" system. It works like the regular cron but is driven by filesystem events instead of time events.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.