hi there...
i'm currently working on some error handling in my scripts...
for example i tried to get the "permission denied" from on of my scripts (if it fails) to be send in a mail...
here is what i'm trying to do...
Code:
message="/gfsdisk/scripts/autoresponder.log"
if [ -f $file ]
then
true > $file &> $message
fi
here is the mail code:
Code:
trap 'errormail' 1 2 3 6 9 14 15 ERR
errormail()
{
for host in ${mailaddr[@]}; do
/bin/mail -s "$subject" $host < "$message"
done
echo mail...
}
if i run the script as root... i don't get any permission denied replys...
when i run it as a non priviledged user i get a "permission denied" messige, but it'S not written in the log file...
what am i doing wrong`?
thx a lot