marsmail-0.2c

This commit is contained in:
Mario Fetka
2011-11-13 00:46:51 +01:00
parent 3cc84d97d2
commit d665510635
24 changed files with 2204 additions and 29 deletions

View File

@@ -1,19 +1,32 @@
#!/bin/bash
#
# Ohmessage: called by ohmail and creates a database of new mail flags
# for users. Sends a message to mars or samba users informing them of
# new mail
# Please create a directory under /tmp called mail where the mail flags
# will be stored..
# log files will be stored in /var/log.
marsserver="yourmarsservername"
mailusr="genericmailuseronmars"
mailpwd="genericmailusrpasswd"
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
if cat /tmp/smbusers.list | grep " $1 " > /dev/null
then
for machine in `smbstatus | grep " $1 " | awk ' {print $5}' | sort | uniq`
for machine in `cat /tmp/smbusers.list | 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
elif cat /tmp/nwusers.list | 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`"
/usr/local/bin/nsend -S $marsserver -U $mailusr -P $mailpwd $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
@@ -21,4 +34,4 @@
echo $s1 > /tmp/mail/$1
fi
# ohmessage by gac@eng.rau.ac.za, eddie@eng.rau.ac.za