ALT Linux Community general discussions
 help / color / mirror / Atom feed
From: Sergei Makarov <smakarov@nes.ru>
To: mandrake-russian@altlinux.ru
Subject: Re: [mdk-re] Re: WinPopup из самбы всей группе
Date: Tue Apr 23 11:41:01 2002
Message-ID: <3CC51064.6000902@nes.ru> (raw)
In-Reply-To: <20020422071652.GP2089@lic145.kiev.ua>

[-- Attachment #1: Type: text/plain, Size: 496 bytes --]

Посмотрите скрипт в аттаче.



Michael Shigorin wrote:
> On Mon, Apr 22, 2002 at 09:14:04AM +0400, Eugene Prokopiev wrote:
> 
>>Как из самбы отправить попап всей группе, а не отдельному компьютеру ?
> 
> (short answer) Кажется, никак.
> 
> (long answer) Можно попробовать наваять какой-то мессенджер,
> который сделает browse (как-то при помощи smbclient, думаю),
> потом распарсить вывод и раскидать в индивидуальном порядке :-(
> 
> Если сделаете -- бросайте сюда, думаю, хором доведем ;-)
> 


[-- Attachment #2: smbwall --]
[-- Type: text/plain, Size: 1921 bytes --]

#!/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 -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];
	#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;


  reply	other threads:[~2002-04-23 11:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-22  9:13 [mdk-re] " Eugene Prokopiev
2002-04-22  9:18 ` Korshunov Ilya
2002-04-22 14:52 ` [mdk-re] WinPopup из самбы всейгруппе admin
2002-04-22 16:00   ` Eugene Prokopiev
2002-04-22 21:03 ` [mdk-re] Re: WinPopup из самбы всей группе Michael Shigorin
2002-04-23 11:41   ` Sergei Makarov [this message]
2002-04-23 11:45     ` [mdk-re] А как эти сообщения под Линухом получать? Иван Евтухович
2002-04-23 12:11       ` [mdk-re] А как этисообщения подЛинухом получать? admin
2002-04-23 11:58   ` [mdk-re] Re: WinPopup из самбы все йгруппе admin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3CC51064.6000902@nes.ru \
    --to=smakarov@nes.ru \
    --cc=mandrake-russian@altlinux.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Community general discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
		mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
	public-inbox-index community

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.community


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git