[Samba] How to handle multi process open smb.conf at the time - Samba

This is a discussion on [Samba] How to handle multi process open smb.conf at the time - Samba ; Hi, everyone I am try to write a program to edit smb.conf, and the question is " If I open smb.conf for editing, but other process such as smbd , nmbd and winbind is reading the file, How to handle ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: [Samba] How to handle multi process open smb.conf at the time

  1. [Samba] How to handle multi process open smb.conf at the time

    Hi, everyone

    I am try to write a program to edit smb.conf, and the question is "
    If I open smb.conf for editing, but other process such as smbd , nmbd and winbind is reading the file, How to handle the this collision, and I want to open this file immediaetly ,and afte closing this file , tell these process to read it."


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

  2. Re: [Samba] How to handle multi process open smb.conf at the time

    On Wed, Jul 09, 2008 at 12:39:13AM +0800, chenyun_zhou wrote:
    > Hi, everyone
    >
    > I am try to write a program to edit smb.conf, and the question is "
    > If I open smb.conf for editing, but other process such as smbd , nmbd and winbind is reading the file, How to handle the this collision, and I want to open this file immediaetly ,and afte closing this file , tell these process to read it."


    Do what all other unix programs do in this circumstance.
    Create a temp smb.conf file and then do an atomic rename
    into place. The next time smbd/nmbd re-read the file (or
    when you tell them to do it via a MSG_SMB_CONF_UPDATED
    message) they'll see the new contents.

    Hope this helps,

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

  3. Re: [Samba] How to handle multi process open smb.conf at the time

    Jeremy Allison wrote:
    > On Wed, Jul 09, 2008 at 12:39:13AM +0800, chenyun_zhou wrote:
    > > Hi, everyone
    > >
    > > I am try to write a program to edit smb.conf, and the question is "
    > > If I open smb.conf for editing, but other process such as smbd , nmbdand winbind is reading the file, How to handle the this collision, and I want to open this file immediaetly ,and afte closing this file , tell these process to read it."

    >
    > Do what all other unix programs do in this circumstance.
    > Create a temp smb.conf file and then do an atomic rename
    > into place. The next time smbd/nmbd re-read the file (or
    > when you tell them to do it via a MSG_SMB_CONF_UPDATED
    > message) they'll see the new contents.


    Hi chenyun_zhou,

    Let me draw your attention to the new registry based
    configuration that is offered as a new feature in 3.2.0.

    Configuration stored in samba's registry.tdb database
    can be used if you activate it in a (minimal) smb.conf.
    Then you can edit the configuration comfortably with
    the new "net conf" command. (e.g. from scripts).
    Since the tdb databases support locking, this method has
    no problems with concurrent access.

    To give you an idea, here is the list of subcommands of net conf:

    net conf list Dump the complete configuration in smb.conf like format.
    net conf import Import configuration from file in smb.conf format.
    net conf listshares List the share names.
    net conf drop Delete the complete configuration.
    net conf showshare Show the definition of a share.
    net conf addshare Create a new share.
    net conf delshare Delete a share.
    net conf setparm Store a parameter.
    net conf getparm Retrieve the value of a parameter.
    net conf delparm Delete a parameter.
    net conf getincludes Show the includes of a share definition.
    net conf setincludes Set includes for a share.
    net conf delincludes Delete includes from a share definition.

    This is simply the output of "net conf" without further arguements.

    For details, see the smb.conf(5) and net(8) manpages.
    Yesterday, I have also started to write a document about this at:
    http://wiki.samba.org/index.php/Registry_Configuration
    But is really only started, needs to be completed...

    There also is a "libsmbconf" library that proveds an
    interface to the configuration, but it is not yet provided
    as a shared library.

    In source/lib/netapi/examples/netdomjoin-gui/ you can
    find an example gui program that uses libsmbconf to edit
    parts of the configuration.

    Cheers - Michael

    --
    Michael Adam
    SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
    phone: +49-551-370000-0, fax: +49-551-370000-9
    AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
    http://www.SerNet.DE, mailto: Info @ SerNet.DE

    --
    To unsubscribe from this list go to the following URL and read the
    instructions: https://lists.samba.org/mailman/listinfo/samba
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.2 (GNU/Linux)
    Comment: comment

    iD8DBQFIc9ZIyU9JOBhPkDQRAhhhAJ9oyF6UuEbczTVmTIEf9x qxtZsaGACfeW/6
    PnugUGKBre7375Izx2pBgKs=
    =4Bi8
    -----END PGP SIGNATURE-----


+ Reply to Thread