mars-mail/ohsendnt
2011-11-13 00:46:51 +01:00

27 lines
662 B
Bash
Executable File

#!/bin/bash
messge=$1
machs=$2
if [ "$messge" = "" ]; then
echo "Usage: ohsendnt \"Message\" \"machine.list\"|ALL"
echo "e.g. ohsendnt \"Hello!\" \"dud.rau.ac.za\""
exit;
fi
if [ "$machs" = "ALL" ]; then
for l in `smbstatus | awk '{ print $5 }' | sed '/machine/d' | sort | uniq | sed '1 d'`
do
echo "$messge" | smbclient -M $l > /dev/nul
d=`date`
echo "Message $messge sent to NT user $l on $d" >> /var/log/ohsentnt.log
done
else
for l in $machs
do
echo "$messge" | smbclient -M $l > /dev/nul
d=`date`
echo "Message $messge sent to NT user $l on $d" >> /var/log/ohsentnt.log
done
fi