From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Message-ID: <3CC51064.6000902@nes.ru> From: Sergei Makarov User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; ru-RU; rv:0.9.9) Gecko/20020302 X-Accept-Language: en-us, en MIME-Version: 1.0 To: mandrake-russian@altlinux.ru Subject: Re: [mdk-re] Re: WinPopup =?KOI8-R?Q?=C9=DA_=D3=C1=CD=C2=D9_?= =?KOI8-R?Q?=D7=D3=C5=CA_=C7=D2=D5=D0=D0=C5?= References: <3CC39C1C.8000104@rmts.donpac.ru> <20020422071652.GP2089@lic145.kiev.ua> Content-Type: multipart/mixed; boundary="------------090105050703020402080405" Sender: mandrake-russian-admin@altlinux.ru Errors-To: mandrake-russian-admin@altlinux.ru X-BeenThere: mandrake-russian@altlinux.ru X-Mailman-Version: 2.0 Precedence: bulk Reply-To: mandrake-russian@altlinux.ru List-Help: List-Post: List-Subscribe: , List-Id: Linux-Mandrake RE / ALT Linux discussion list List-Unsubscribe: , List-Archive: Date: Tue Apr 23 11:41:01 2002 X-Original-Date: Tue, 23 Apr 2002 11:42:28 +0400 Archived-At: List-Archive: List-Post: This is a multi-part message in MIME format. --------------090105050703020402080405 Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 8bit Посмотрите скрипт в аттаче. Michael Shigorin wrote: > On Mon, Apr 22, 2002 at 09:14:04AM +0400, Eugene Prokopiev wrote: > >>Как из самбы отправить попап всей группе, а не отдельному компьютеру ? > > (short answer) Кажется, никак. > > (long answer) Можно попробовать наваять какой-то мессенджер, > который сделает browse (как-то при помощи smbclient, думаю), > потом распарсить вывод и раскидать в индивидуальном порядке :-( > > Если сделаете -- бросайте сюда, думаю, хором доведем ;-) > --------------090105050703020402080405 Content-Type: text/plain; charset=KOI8-R; name="smbwall" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="smbwall" #!/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 # # Cleanup and corrections by # Michal Jaegermann # 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() { 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; --------------090105050703020402080405--