diff options
Diffstat (limited to 'examples/misc')
-rw-r--r-- | examples/misc/extra_smbstatus | 50 | ||||
-rw-r--r-- | examples/misc/wall.perl | 69 |
2 files changed, 0 insertions, 119 deletions
diff --git a/examples/misc/extra_smbstatus b/examples/misc/extra_smbstatus deleted file mode 100644 index 584284feb34..00000000000 --- a/examples/misc/extra_smbstatus +++ /dev/null @@ -1,50 +0,0 @@ -Here's something that Paul Blackman sent me that may be useful: - -------------------- -I created this script to do a few things that smbstatus doesn't at the -moment. Perhaps you might want to include these. Sorry I haven't -added things at source level, script was quick&easy. - -******* -#!/bin/csh -if ($1 == "-p") then - smbstatus -p |sort -u -else if ($1 == "-c") then - echo There are `smbstatus -p |sort -u |grep -n -v z |grep -c :` unique smbd processes running. - else if ($1 == "-l") then - echo `date '+ %d/%m/%y %H:%M:%S'` `smbstatus -p |sort -u |grep -n -v z |grep -c :` >>$2 -else if ($1 == "-cs") then - echo There are `smbstatus |awk '$1==share {n++;} END {print n}' share=$2` concurrent connections to share: $2 -else if ($1 == "-csl") then - echo `date '+ %d/%m/%y %H:%M:%S'` `smbstatus |awk '$1==share {n++;} END {print n}' share=$2` >>$3 -else - echo "'smbstat -c' ==> Count unique smbd processes." - echo "'smbstat -p' ==> List unique smbd processes." - echo "'smbstat -l logfile' ==> Append a log entry for the number of" - echo " concurrent and unique processes to logfile." - echo "'smbstat -cs sharename'" - echo " ==> Count processes connected to sharename (assumed unique)" - echo "'smbstat -csl sharename logfile'" - echo " ==> Append a log entry for the number of concurrent" - echo " processes connected to sharename (assumed unique)" -endif -****** - -Run this script from cron eg. - -0,5,10,15,20,25,30,35,40,50,55 * * * * /usr/local/samba/bin/smbstat -l /usr/local/samba/var/smbdcount.log - -and you get a good idea of usage over time. - -Cheers, -~^ MIME OK ^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~ - o | Paul Blackman ictinus@lake.canberra.edu.au - o | Co-operative Research ------------------------ - o _ | Centre For Freshwater Ecology. Ph. (Aus) 06 2012518 - -- (") o | University of Canberra, Australia. Fax. " 06 2015038 - \_|_-- |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - | | "Spend a little love and get high" - _/ \_ | - Lenny Kravitz -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -~~~~~~~~~~~~~~ SAMBA Web Pages: http://samba.anu.edu.au/samba/ ~~~~~~~~~~~~~~ - diff --git a/examples/misc/wall.perl b/examples/misc/wall.perl deleted file mode 100644 index 9303658ce14..00000000000 --- a/examples/misc/wall.perl +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/local/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/local/bin/smbstatus"; -$smbshout = "/usr/local/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; - |