v-rod
03-25-2002, 10:40 AM
Hello all,
We are trying to get a cron job to "find" spam scripts from the "/home" directory to search all users. The only way we can get it to work is to setup a different cron for each user.
I am thinking it is a permissions or owner issue. I've searched for an answer to this for hours now with no luck...
Thanks for any help!
v-rod
v-rod
03-25-2002, 11:16 AM
Fixed it!
Changed "find" to "/usr/bin/find"...
v-rod
v-rod
03-25-2002, 12:38 PM
Okay, we have that working now. However, how do we get the following shell script to search for multiple files and only send one email?
/usr/bin/find /home2 -type f -name "$file" | mail email@address.com
Thank you for your time!
v-rod
priyadi
03-26-2002, 09:33 AM
Originally posted by v-rod
Okay, we have that working now. However, how do we get the following shell script to search for multiple files and only send one email?
/usr/bin/find /home2 -type f -name "$file" | mail email@address.com
Thank you for your time!
v-rod
Well, your command line above will send you exactly one email. But I think you left out the rest of your scripts, I have no idea how to fix it without the rest of your script.
v-rod
03-29-2002, 10:56 AM
Hi,
That's it...
I have like six lines just like that to search for six different files. I get six blank emails twice a day(if I'm lucky). Just would like to know how to make it only send an email when a file is found or make one line search for multiple files.
Thanks for your time!
v-rod
You can redirect and append all your "searching" using >>
For example:
/usr/bin/find /home2 -type f -name "$file1" > hunting.txt
/usr/bin/find /home2 -type f -name "$file2" >> hunting.txt
...
and at the end
mail email@address.com < hunting.txt
Hope this helps :)
bitserve
03-30-2002, 05:26 AM
You're probably getting blank emails because you don't have "-print" at the end of your find command.
priyadi
03-30-2002, 07:12 AM
Originally posted by v-rod
Hi,
That's it...
I have like six lines just like that to search for six different files. I get six blank emails twice a day(if I'm lucky). Just would like to know how to make it only send an email when a file is found or make one line search for multiple files.
Thanks for your time!
v-rod
Got it... maybe this will work:
#!/bin/sh
(
find -type f -name file1
find -type f -name file2
.....
) | mail your@email.address