Hisma
Explorer
- Joined
- Mar 23, 2013
- Messages
- 87
Hello
I am a freenas/linux newb in general.
What I would like to know, is if it's possible to set up a cron task, or script of some sort, that is event-based instead of periodic. So, it can detect when a new directory gets created inside of a target directory.
When the script runs, it will search if any of the subdirectories inside the target directory contain words that match with the new directory.
For example, I have a post-processing script in my jail that creates a new directory in my '/TV' directory after it downloads a new show. The show has a name like 'Chopped.S15E02.720p.HDTV.x264-d0rks'. I want to move that directory into where the rest of my Chopped episodes are, entitled 'Chopped'.
So, the script will search if the new directory has any words/words that match with an existing directory. It will then see there is a directory named 'chopped', and move the new show from the '/TV' directory into '/TV/Chopped'.
That's the gist of what I'm trying to do, basically a small event-driven media management script.
Can someone point me in the right direction on how to do this? I want to actually learn how to do it myself, but I'm a scripting newb. I do have basic java/python experience, so if someone can give me some resources to get started, I might be able to figure it out on my own.
But like I said, I'm a newb and have no idea where to start. Hell, there may be a much easier way to do this.
By the way, I think SABnzbd has something like this built in, but I would prefer to have an independent script so -
a) it won't matter if i download the show via torrent or usenet
b) i actually learn something about linux scripting in the process.
Any help is welcome. Like I said, I would like to get pointed in the right direction, and perhaps get some advice.
Thanks!!
I am a freenas/linux newb in general.
What I would like to know, is if it's possible to set up a cron task, or script of some sort, that is event-based instead of periodic. So, it can detect when a new directory gets created inside of a target directory.
When the script runs, it will search if any of the subdirectories inside the target directory contain words that match with the new directory.
For example, I have a post-processing script in my jail that creates a new directory in my '/TV' directory after it downloads a new show. The show has a name like 'Chopped.S15E02.720p.HDTV.x264-d0rks'. I want to move that directory into where the rest of my Chopped episodes are, entitled 'Chopped'.
So, the script will search if the new directory has any words/words that match with an existing directory. It will then see there is a directory named 'chopped', and move the new show from the '/TV' directory into '/TV/Chopped'.
That's the gist of what I'm trying to do, basically a small event-driven media management script.
Can someone point me in the right direction on how to do this? I want to actually learn how to do it myself, but I'm a scripting newb. I do have basic java/python experience, so if someone can give me some resources to get started, I might be able to figure it out on my own.
But like I said, I'm a newb and have no idea where to start. Hell, there may be a much easier way to do this.
By the way, I think SABnzbd has something like this built in, but I would prefer to have an independent script so -
a) it won't matter if i download the show via torrent or usenet
b) i actually learn something about linux scripting in the process.
Any help is welcome. Like I said, I would like to get pointed in the right direction, and perhaps get some advice.
Thanks!!