summaryrefslogtreecommitdiff
path: root/examples/misc
diff options
context:
space:
mode:
authorSamba Release Account <samba-bugs@samba.org>1996-05-04 07:50:46 +0000
committerSamba Release Account <samba-bugs@samba.org>1996-05-04 07:50:46 +0000
commit0db2ec0e94c6849202a2aa6e9965bfef0acb4e7a (patch)
treea07fdef481e206a89917895bd3dbe2eda0f25ee3 /examples/misc
parentce9f59147274357ef0ab7ae968564fb804430cdc (diff)
parent0e8fd3398771da2f016d72830179507f3edda51b (diff)
downloadsamba-0db2ec0e94c6849202a2aa6e9965bfef0acb4e7a.tar.gz
samba-0db2ec0e94c6849202a2aa6e9965bfef0acb4e7a.tar.bz2
samba-0db2ec0e94c6849202a2aa6e9965bfef0acb4e7a.zip
This commit was generated by cvs2svn to compensate for changes in r4,
which included commits to RCS files with non-trunk default branches. (This used to be commit c8a46aca039f16b00bcd177ac2bb9962fdfff529)
Diffstat (limited to 'examples/misc')
-rw-r--r--examples/misc/extra_smbstatus47
-rw-r--r--examples/misc/wall.perl45
2 files changed, 92 insertions, 0 deletions
diff --git a/examples/misc/extra_smbstatus b/examples/misc/extra_smbstatus
new file mode 100644
index 0000000000..b018f3dcce
--- /dev/null
+++ b/examples/misc/extra_smbstatus
@@ -0,0 +1,47 @@
+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
+ smbstatus |sort +3 -4 -u
+endif
+******
+
+The '-p' option was just to show unique PIDs.
+
+The more important ones are the '-c' and '-l' options '-c' just counts
+the number of unique smbd's, While '-l' logs this count with date and
+time to a log file specified on the command line. I'm using '-l' at
+the moment with cron to give me an idea of usage/max connections etc.
+I was also thinking of doing a log for individual/specified services.
+
+The default (last) option was to show unique PIDs with user names.
+Unfortunately this still lists all file locks etc. This would be
+better with a 'no locked files' option from smbstatus (or is there one
+that I didn't see)
+
+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.canberra.edu.au/pub/samba/samba.html ~~~~~
+
diff --git a/examples/misc/wall.perl b/examples/misc/wall.perl
new file mode 100644
index 0000000000..fc3dc2e2c0
--- /dev/null
+++ b/examples/misc/wall.perl
@@ -0,0 +1,45 @@
+#!/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>
+#
+#=============================================================================
+$smbstatus = "/usr/local/bin/smbstatus";
+$smbclient = "/usr/local/bin/smbclient";
+
+print STDOUT "\nEnter message for Samba clients of this host\n";
+print STDOUT "(terminated with single '.' or end of file):\n";
+
+while ( <STDIN> ) {
+ /^\.$/ && last;
+ push(@message, $_);
+}
+
+if ( $ARGV[0] ne "" ) {
+ $debug && print STDOUT "Was given args: \n\t @ARGV\n";
+ foreach $client ( @ARGV ) {
+ $pcclient{$client} = $client;
+ }
+} else {
+ open( PCLIST, "$smbstatus | /bin/awk '/^[a-z]/ {print $5}' | /bin/sort | /bin/uniq|");
+ while ( <PCLIST> ) {
+ /^[a-z]+[a-z0-9A-Z-_]+.+/ || next;
+ ($share, $user, $group, $pid, $client, @junk) = split;
+ $pcclient{$client} = $client;
+ }
+ close(PCLIST);
+}
+
+foreach $pc ( keys(%pcclient) ) {
+ print STDOUT "Sending message ";
+ $debug && print STDOUT " <@message> \n";
+ print STDOUT "To <$pc>\n";
+ open(SENDMSG,"|$smbclient -M $pc") || next;
+ print SENDMSG @message;
+ close(SENDMSG);
+}