Initial version imported to CVS
[Samba.git] / examples / misc / extra_smbstatus
blobb018f3dcce9d2d3034e53a047e93af716895c433
1 Here's something that Paul Blackman sent me that may be useful:
3 -------------------
4 I created this script to do a few things that smbstatus doesn't at the
5 moment.  Perhaps you might want to include these.  Sorry I haven't
6 added things at source level, script was quick&easy.
8 *******
9 #!/bin/csh
10 if ($1 == "-p") then
11   smbstatus -p |sort -u
12 else if ($1 == "-c") then
13   echo There are `smbstatus -p |sort -u |grep -n -v z |grep -c :` unique
14 smbd processes running.
15  else if ($1 == "-l") then
16   echo `date '+ %d/%m/%y %H:%M:%S'` `smbstatus -p |sort -u |grep -n -v z
17 |grep -c :` >>$2
18 else
19   smbstatus |sort +3 -4 -u
20 endif
21 ******
23 The '-p' option was just to show unique PIDs.
25 The more important ones are the '-c' and '-l' options '-c' just counts
26 the number of unique smbd's, While '-l' logs this count with date and
27 time to a log file specified on the command line.  I'm using '-l' at
28 the moment with cron to give me an idea of usage/max connections etc.
29 I was also thinking of doing a log for individual/specified services.
31 The default (last) option was to show unique PIDs with user names.
32 Unfortunately this still lists all file locks etc.  This would be
33 better with a 'no locked files' option from smbstatus (or is there one
34 that I didn't see)
36 Cheers,
37 ~^ MIME OK ^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~
38     o        |  Paul Blackman                  ictinus@lake.canberra.edu.au
39         o    |  Co-operative Research              ------------------------
40    o  _      |  Centre For Freshwater Ecology.        Ph.  (Aus) 06 2012518
41   -- (") o   |  University of Canberra, Australia.       Fax. "  06 2015038
42     \_|_--   |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
43       |      |  "Spend a little love and get high"
44     _/ \_    |                                              - Lenny Kravitz
45 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
46 ~~~~ SAMBA Web Pages: http://samba.canberra.edu.au/pub/samba/samba.html ~~~~~