[Samba] How to send a domain wide message with smbclient?
Andrew Gaffney
agaffney at skylineaero.com
Mon Dec 29 15:04:57 GMT 2003
From a quick glance at the script, it does the same thing as the script that I posted.
Travis L. Bean wrote:
> I found a working script to send a domain wide message:
> http://www.netsys.com/sunmgr/1998-10/msg00122.html. This is a modified
> version of the /examples/misc/wall.perl included in the Samba 3.x.x
> distribution. The wall.perl script in the Samba distribution appears to
> be broken, because it does not send a message unless a host name is
> provided. Perhaps someone on the samba team would be so kind as to view
> the differences between these two scripts and incorporate these
> modifications into the wall.perl script that is included in the Samba
> distribution.
>
>
> Thanks,
>
> Travis
>
> -----Original Message-----
> From: Andrew Gaffney [mailto:agaffney at skylineaero.com]
> Sent: Sunday, December 28, 2003 6:05 AM
> To: Travis L. Bean
> Cc: samba at lists.samba.org
> Subject: Re: [Samba] How to send a domain wide message with smbclient?
>
> Travis L. Bean wrote:
>
>>Is there a way to send a message to all users currently logged into a
>>Samba domain controller? The reason why I ask is that I have a Samba
>>3.x.x primary/backup domain controller setup and as soon as the system
>
>
>>monitor detects that the primary domain controller is offline I would
>>like to execute a command to send a domain wide message telling all
>>domain users to save their work to the local machine, log off the pdc
>>and log back in to the bdc. Is there a way to accomplish this with
>>smbclient or another open source software solution?
>
>
> You can send a message with a command such as 'echo "Testing" |
> smbclient -M <machine>'. I
> don't know if there is a way to send a message to all clients. You could
> try to do it
> yourself. If you have any bash/sed/awk or perl abilities, you could
> write a script that
> parses the output of 'smbstatus' to determine which clients are
> currently logged on to the
> domain. It could then go through a loop and send the message to every
> client. In perl:
>
>
> #!/usr/bin/perl
>
> open PIPE, "smbstatus |";
> foreach $line (<PIPE>) {
> if($line =~ /\d+\s+(\S+)\s+\S+\s+(\S+)\s+\((.+)\)/) {
> system "echo 'Attention user $1! PDC is down. Please save all work
> to local disk,
> logout, and log back in on the BDC.' | smbclient -M $2 -I $3";
> }
> }
>
>
> I ran a brief test on this and it appears to work correctly with 3.0.1.
>
--
Andrew Gaffney
More information about the samba
mailing list