summaryrefslogtreecommitdiff
path: root/examples/misc/extra_smbstatus
blob: b018f3dcce9d2d3034e53a047e93af716895c433 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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 ~~~~~