mars-mail/ohsendnt

32 lines
856 B
Plaintext
Raw Permalink Normal View History

2011-11-13 00:46:51 +01:00
#!/bin/bash
2011-11-13 00:46:51 +01:00
#
# OhSendNt is a console broadcast tool to send messages from the unix console
# to the network users. Usefull for sending broadcasts that server is going
# down in 10 minutes or whatever :)
#
2011-11-13 00:46:51 +01:00
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