[Samba] smbstatus questions

2010-10-25 Thread David Roid
Hello list,

I'm running a samba 3.5.3 CTDB cluster, found the output is different

Q1:  What does the 0: mean in pid column? There was no such stuff in
non-CTDB smbstatus output.

snip
samba_01:~ # smbstatus -S 2/dev/null

Service  pid machine   Connected at
---
ben  0:21363   samba Mon Oct 25 17:59:35 2010
ben  0:21442   samba Mon Oct 25 17:59:39 2010

snip

Q2: How to parse smbstatus to capture service column and pid column? as in
case of homes share the service is named as username, while domain username
may contain whitespace(s)?

snip
samba_01:~ # smbstatus -S 2/dev/null

Service  pid machine   Connected at
---
ben 0:21363   samba Mon Oct 25 17:59:35 2010
benjamin linus   0:21442   samba Mon Oct 25 17:59:39 2010
benjamin[space]linux
james  ford0:21550   samba Mon Oct 25 18:00:29 2010
 james[space][space]ford, awk/cut can't handle this well, they only keep
one space.

snip

I need these column to close specific shares with smbcontrol, but fail to
capture them. Is there any alternative?

Regards
-David
-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba


Re: [Samba] smbstatus questions

2010-10-25 Thread Volker Lendecke
On Mon, Oct 25, 2010 at 06:18:27PM +0800, David Roid wrote:
 Hello list,
 
 I'm running a samba 3.5.3 CTDB cluster, found the output is different
 
 Q1:  What does the 0: mean in pid column? There was no such stuff in
 non-CTDB smbstatus output.

That's the node number. If you connect to another node, that
number will change.

 Q2: How to parse smbstatus to capture service column and pid column? as in
 case of homes share the service is named as username, while domain username
 may contain whitespace(s)?
 
 snip
 samba_01:~ # smbstatus -S 2/dev/null
 
 Service  pid machine   Connected at
 ---
 ben 0:21363   samba Mon Oct 25 17:59:35 2010
 benjamin linus   0:21442   samba Mon Oct 25 17:59:39 2010
 benjamin[space]linux
 james  ford0:21550   samba Mon Oct 25 18:00:29 2010
  james[space][space]ford, awk/cut can't handle this well, they only keep
 one space.
 
 snip
 
 I need these column to close specific shares with smbcontrol, but fail to
 capture them. Is there any alternative?

Not really, sorry. You might want to send a patch to
smbstatus that makes the output machine-parseable.

Volker
-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba


Re: [Samba] smbstatus questions

2010-10-25 Thread Harry Jede
On 18:33:12 wrote David Roid:
 Hello list,

 I'm running a samba 3.5.3 CTDB cluster, found the output is different

 Q1:  What does the 0: mean in pid column? There was no such stuff
 in non-CTDB smbstatus output.

 snip
 samba_01:~ # smbstatus -S 2/dev/null

 Service  pid machine   Connected at
 ---
 ben  0:21363   samba Mon Oct 25 17:59:35 2010
 ben  0:21442   samba Mon Oct 25 17:59:39 2010

 snip

 Q2: How to parse smbstatus to capture service column and pid column?
 as in case of homes share the service is named as username, while
 domain username may contain whitespace(s)?

 snip
 samba_01:~ # smbstatus -S 2/dev/null

 Service  pid machine   Connected at
 ---
 ben 0:21363   samba Mon Oct 25 17:59:35
 2010 benjamin linus   0:21442   samba Mon Oct 25 17:59:39
 2010 benjamin[space]linux
 james  ford0:21550   samba Mon Oct 25 18:00:29
 2010  james[space][space]ford, awk/cut can't handle this well,
 they only keep one space.

 snip
awk can handle this, but I like sed. You may try this sed one liner.

smbstatus -S 2/dev/null |sed -ne 's/^\(.*[[:alnum:]]\)[[:space:]]\{1,
\}\([[:digit:]]\{1,2\}\:[[:digit:]]\{1,20\}\)[[:space:]]\{1,\}\([[:alnum:]]*\)
[[:space:]]\{1,\}\(.*\)$/\...@_\2_@_...@_\4/p'

It only works for ctdb. You may change _...@_ with another delimeter like \t or 
\; ;-) . 

 I need these column to close specific shares with smbcontrol, but
 fail to capture them. Is there any alternative?

 Regards
 -David



-- 

Gruss
Harry Jede
-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba


Re: [Samba] smbstatus questions

2010-10-25 Thread David Roid
It works! Thanks Harry!

2010/10/26 Harry Jede walk2...@arcor.de

 On 18:33:12 wrote David Roid:
  
  Q2: How to parse smbstatus to capture service column and pid column?
  as in case of homes share the service is named as username, while
  domain username may contain whitespace(s)?
 
  snip
  samba_01:~ # smbstatus -S 2/dev/null
 
  Service  pid machine   Connected at
  ---
  ben 0:21363   samba Mon Oct 25 17:59:35
  2010 benjamin linus   0:21442   samba Mon Oct 25 17:59:39
  2010 benjamin[space]linux
  james  ford0:21550   samba Mon Oct 25 18:00:29
  2010  james[space][space]ford, awk/cut can't handle this well,
  they only keep one space.
 
  snip

awk can handle this, but I like sed. You may try this sed one liner.

 smbstatus -S 2/dev/null |sed -ne 's/^\(.*[[:alnum:]]\)[[:space:]]\{1,

 \}\([[:digit:]]\{1,2\}\:[[:digit:]]\{1,20\}\)[[:space:]]\{1,\}\([[:alnum:]]*\)
 [[:space:]]\{1,\}\(.*\)$/\...@_\2_@_...@_\4/p'

 It only works for ctdb. You may change _...@_ with another delimeter like \t
 or
 \; ;-) .

  I need these column to close specific shares with smbcontrol, but
  fail to capture them. Is there any alternative?
 
  Regards
  -David



 --

 Gruss
Harry Jede
 --
 To unsubscribe from this list go to the following URL and read the
 instructions:  https://lists.samba.org/mailman/options/samba

-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba