need the PID of the running smbd - Probs with %d

Richard Sharpe sharpe at ns.aus.com
Tue Jul 11 09:33:57 GMT 2000


At 06:53 PM 7/11/00 +1000, Stephan Lauffer wrote:
>Hi all!
>
>Need the PID of the smbd for the actual share... %d sounds good:
>"%d = The process id of the current server  process." says man smb.conf
>
>I´ve a problem (am i right or not (super trivial test)):
>(samba 2.0.7)
>
>--- smb.conf ---
>[test]
>   path=/tmp
>   root preexec = /tmp/smb.pl %d
>   indlude = /tmp/smb.%d.inc
>---
>
>--- smb.pl ---
>#!/usr/bin/perl -w
>
>@input=@ARGV;
>
>system ("echo \"path=/usr\"  > /tmp/smb.$input[0].inc");
>system ("killall -HUP smbd");	# smbd should reload his config...
>---
>
>Now i get the following:
>---
>lisa:/ # testparm | grep "test" -A 3 && ps faucx | grep "smbd"

In testparm, it doesn't work, or rather, it gives you the pid of the
process running, which is you, I imagine.

This will work for smbd, though, as you can see by doing:

[test-%d]
  path = some-path

and then browse the server, after telling Samba to re-read its config file.

>[test]
>      path = /tmp
>      include = /tmp/smb.26090.inc
>      root preexec = /tmp/smb.pl %d
>root      1014  0.0  0.7  3180 1936 ?        S    Jul05   0:00 vmware-smbd
>root     22637  0.0  0.4  2476 1140 ?        S    Jul10   0:00 smbd
>root     25776  0.0  0.9  3624 2368 ?        S    09:30   0:00  \_ smbd
>lauffer  26065  0.0  0.5  3640 1352 ?        S    10:39   0:00  \_ smbd
>---
>
>Ups! Why is %d 26090 ?!
>May I understand %d wrong... I thought it tells me the PID of the smbd
>for the share. Or... hm... will the PID be changed?
>
>Thanx for help!
>
>Liebe Gruesse,
>Stephan Lauffer
>
>[ Paedagogische Hochschule Freiburg - Systemtechnik - Germany    ]
>[ Abteilung ZIK: <a href="http://www.ph-freiburg.de/zik">WWW</a> ]
>
>
>

Regards
-------
Richard Sharpe, sharpe at ns.aus.com
Samba (Team member, www.samba.org), Ethereal (Team member, www.zing.org)
 




More information about the samba-technical mailing list