APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

WinPopup

Bruce Garlock came across this script and asked the authors for permission to republish it here. This was the author's response:

Hm, how old this ditty is? I did not really touch Samba for a very loooong while. Does it still works with current versions? I even do not really remember how this script looks although I can roughly imagine.:-) I thought that at least in some moment this was included with some other third-party examples in Samba sources. I may mix that with some other two- or three-liner.

If you think that this is still useful then, sure, go ahead and publish it. It is already somewhere on the net. I hope that it is not too grotty. Likely faster to throw in something like that when you need it instead of trying to find it somewhere.

Michal

Bruce notes: FYI: I have tested this on SAMBA 2.2.7, RH AS 2.1

This is a perl script that sends out a SMB Message to all users via "WinPopUp", using SAMBA. I thought it would be a nice addition for the code section of the website. The authors and credits are part of the perl script.

#!/usr/bin/perl
# 
#@(#) smb-wall.pl Description:
#@(#) A perl script which allows you to announce whatever you choose to
#@(#) every PC client currently connected to a Samba Server...
#@(#) ...using "smbclient -M" message to winpopup service.
#@(#) Default usage is to message every connected PC.
#@(#) Alternate usage is to message every pc on the argument list.
#@(#)  Hacked up by Keith Farrar <farrar@parc.xerox.com>
#
# Cleanup and corrections by
# Michal Jaegermann <michal@ellpspace.math.ualberta.ca>
# Message to send can be now also fed (quietly) from stdin; a pipe will do.
#=============================================================================

$smbstatus = "/usr/bin/smbstatus";
$smbshout = "/usr/bin/smbclient -d 3 -M";

if (@ARGV) {
    @clients = @ARGV;
    undef @ARGV;
}
else {  # no clients specified explicitly
    open(PCLIST, "$smbstatus |") || die "$smbstatus failed!.\n$!\n";
    while(<PCLIST>) {
        last if /^Locked files:/;
        split(' ', $_, 6);
        # do not accept this line if less then six fields
        next unless $_[5];
        # if you have A LOT of clients you may speed things up by
        # checking pid - no need to look further if this pid was already
        # seen;  left as an exercise :-)
        $client = $_[4];
        print "\n",$client;
#       next unless $client =~ /^\w+\./;       # expect 'dot' in a client name
        next if grep($_ eq $client, @clients); # we want this name once
        push(@clients, $client);
    }
    close(PCLIST);
}

if (-t) {
    print <<'EOT';

Enter message for Samba clients of this host
(terminated with single '.' or end of file):
EOT

    while (<>) {
        last if /^\.$/;
        push(@message, $_);
    }
}
else { # keep quiet and read message from stdin
    @message = <>;
}

foreach(@clients) {
    print "To $_:\n";
    if (open(SENDMSG,"|$smbshout $_")) {
        print SENDMSG @message;
        close(SENDMSG);
    }
    else {
        warn "Cannot notify $_ with $smbshout:\n$!\n";
    }
}

exit 0;
 


Got something to add? Send me email.


2 comments



Increase ad revenue 50-250% with Ezoic


More Articles by © Keith Farrar, Michal Jaegermann



I had use the smb-wall.pl script as base for other scripts. I would publish this scripts under the GPL-License. Now I'm looking for the author Keith Farrar to ask him for his "yes", that I can do this.
Please Keith Farrar look at my homepage www.tei-lin-net.de and contact me to say your meaning to my wish to publish the script "smb2lmhost", "smb-wall" and "smb-user-wall" under the GPL-License.

Heiko Teichmeier

-----------------

There exists a module on CPAN called Net::NetSend ( http://search.cpan.org/~greb/Net-NetSend-0.11/ ) which does send Windows popup messages directly. No Samba client is required to use this module.

(November 27, 2004)






Sun May 29 06:26:04 2005: 590   anonymous


I contributed the script to the Samba team as a GPL Perl script.
-Keith <farrar@parc.xerox.com>






Thu Feb 11 10:33:22 2010: 8065   anonymous

gravatar


Sir/madam,
This is not complaint. Its my request to you. I have installed Ubuntu in my machines, now i want to communicate (send and receive ) messages between my computers. For that i want real popup messaging software. So, please could you kindly help me?

Regards
Wangdi

------------------------
Kerio Samepage


Have you tried Searching this site?

Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us





If we define Futurism as an exploration beyond accepted limits, then the nature of limiting systems becomes the first object of exploration. (Frank Herbert)





This post tagged: