25 lines
962 B
Plaintext
25 lines
962 B
Plaintext
|
#!/bin/bash
|
||
|
s1="`cat /var/spool/mail/$1 | grep Subject | wc -l`"
|
||
|
let s2=`cat /tmp/mail/$1`
|
||
|
if let "$s1 > $s2"
|
||
|
then
|
||
|
if smbstatus | grep " $1 " > /dev/null
|
||
|
then
|
||
|
for machine in `smbstatus | grep " $1 " | awk ' {print $5}' | sort | uniq`
|
||
|
do
|
||
|
echo "$1 has new mail `grep From: /var/spool/mail/$1 | tail --lines=1`" | smbclient -M $machine 2>&1 > /dev/null
|
||
|
echo $s1 > /tmp/mail/$1
|
||
|
echo "`date` -- Sent notification to SMB user $1 at $machine" >> /var/log/ohmessage.log
|
||
|
done
|
||
|
elif /usr/local/bin/nwuserlist -S ohamster -U ohmessage -P sendthemall | grep -i " $1 " > /dev/null
|
||
|
then
|
||
|
/usr/local/bin/nsend -S ohamster -U ohmessage -P sendthemall $1 "New mail `grep From: /var/spool/mail/$1 | tail --lines=1`"
|
||
|
echo $s1 > /tmp/mail/$1
|
||
|
echo "`date` -- Sent notification to NetWare user $1" >> /var/log/ohmessage.log
|
||
|
fi
|
||
|
else
|
||
|
echo $s1 > /tmp/mail/$1
|
||
|
fi
|
||
|
|
||
|
|