0
1
The following script runs and finds if any new suid has been changed, and redirects the output to a file.
I want to add a mail command in the script, that will send mail to someone@domain.com. If changes have been made, add a subject line ("Changes have been made") and attach a file (changes.new
). If no changes have been made, add a different subject line ("no changes has been made").
#!/usr/local/bin/bash
if [ ! -f "$/suid.old" ]
then
find / -perm -4000 -o -perm -2000 > ol.list
else
find / -perm -4000 -o -perm -2000 > new.suid
diff suid.old suid.new > changes.new
fi
hello, do i have to specify myfile myfile twice. – None – 2010-02-09T02:28:39.223
1yes. why don't you try it out? type the above command and run it, then try specifying file name once and run it again. – user31894 – 2010-02-09T03:03:45.050
Hello, Actaully I was hoping to include the mail command inside the script. Plan was to run this script in the cron utility every night, and cron will mail the file if it finds any changes in the file once started. How can i write the mail command inside the script and run it from the cron utility? – None – 2010-02-09T04:11:24.220
just put the command in the appropriate if/else statement. – user31894 – 2010-02-09T04:33:48.037