using automator to execute a bash script

Hello,
I like hazel quite a bit, and it has saved me quite a bit of time. Now, I just need to get a hazel for the real world, and I can have things like "empty the trash every sunday" done automatically.
I have hazel watching my documents folder. Items that have not been modified for over a month get "archived". but I don't mean zipped up. Due to a recent computer failure, data security and reliability has become important to me. So for older stuff, i want to make sure there are par2 files for it. I have it set to 10% redunancy, which should work for any small glitches. the par2 is created via the command line(via par2cmdline)
I achieve (after much tinkering) usablility of this command line tool via automator, which hazel can work with. It takes selected files, and runs the par2create command on them.
So, file is deemed old enough -> executes automator workflow -> executes shell command.
here's the issue: when i select multiple items in the finder, it works fine. the workflow has 'get selected finder items" first, which then uses that for input to the script.
but getting hazel to do it automatically is proving tricky. I can't use the "get selected finder items" since it's not a finder function. So, I remove that first rule and just run the command... which only works on a single file, and thats it.
this is the script that automator executes:
THE_FILES=("$@")
for (( i = 0; i < ${#THE_FILES[@]}; i++ ))
do
/opt/local/bin/par2create -r12 -n1 -u "${THE_FILES[$i]}"
done
So, basically: if I were to execute this on a bunch of files manually, it works wonderfully. automator dumps the files into the $@ variable and all is well. But doing it via hazel, I am having issues, and I'm not sure if I need to tweak the script, or what the best way to get it o work.
I'm tired, which is probably obvious... and more or less stuck. if anyone has any idea's or information, I would appreciate it.
I like hazel quite a bit, and it has saved me quite a bit of time. Now, I just need to get a hazel for the real world, and I can have things like "empty the trash every sunday" done automatically.
I have hazel watching my documents folder. Items that have not been modified for over a month get "archived". but I don't mean zipped up. Due to a recent computer failure, data security and reliability has become important to me. So for older stuff, i want to make sure there are par2 files for it. I have it set to 10% redunancy, which should work for any small glitches. the par2 is created via the command line(via par2cmdline)
I achieve (after much tinkering) usablility of this command line tool via automator, which hazel can work with. It takes selected files, and runs the par2create command on them.
So, file is deemed old enough -> executes automator workflow -> executes shell command.
here's the issue: when i select multiple items in the finder, it works fine. the workflow has 'get selected finder items" first, which then uses that for input to the script.
but getting hazel to do it automatically is proving tricky. I can't use the "get selected finder items" since it's not a finder function. So, I remove that first rule and just run the command... which only works on a single file, and thats it.
this is the script that automator executes:
THE_FILES=("$@")
for (( i = 0; i < ${#THE_FILES[@]}; i++ ))
do
/opt/local/bin/par2create -r12 -n1 -u "${THE_FILES[$i]}"
done
So, basically: if I were to execute this on a bunch of files manually, it works wonderfully. automator dumps the files into the $@ variable and all is well. But doing it via hazel, I am having issues, and I'm not sure if I need to tweak the script, or what the best way to get it o work.
I'm tired, which is probably obvious... and more or less stuck. if anyone has any idea's or information, I would appreciate it.