Changeset 844 for branches


Ignore:
Timestamp:
Feb 12, 2014, 4:25:35 PM (12 years ago)
Author:
Herwig Bauernfeind
Message:

smb.cmd 3.1.8: Support for several options introduced in Samba 3.6, fix Ticket #235

Location:
branches/scripts/smb_init
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/scripts/smb_init/b4smb.cmd

    r266 r844  
    1 /* B4SMB.CMD */
     1/*
     2  Samba Server for eComStation (OS/2) tools
     3 
     4  (c) 2007-2014 Herwig Bauernfeind for bww bitwise works GmbH.
     5  Script:  B4SMB.CMD, requires REXX.
     6  Purpose: This script is executed before the Samba daemons are actually
     7           started. You may put arbitrary tasks in here. There are several
     8           task templates implemented using status flags - set to 1 to enable
     9           the feature, or any other value to disable the feature
     10  Syntax:  No parameters.
     11 */
     12
     13ArchLogs = 1 /* Move previous logfiles to archive (by Yuri Dario) */
     14DelLogs  = 0 /* Remove previous logfiles only */
     15SaveCfg  = 1 /* Save a snapshot of the current Samba configuration */
     16DelTDBs  = 1 /* Remove transient .tdb files */
     17DHCPWait = 1 /* wait until an address was obtained by the DHCP server */
     18
     19/* Setup places */
     20ETC      = value("ETC",,"OS2ENVIRONMENT")
     21UNIXETC  = value("UNIXROOT",,"OS2ENVIRONMENT")'\etc'
     22SMB_LOGS = value("SMB_LOGS",,"OS2ENVIRONMENT")
     23SMB_LOCK = value("SMB_LOCK",,"OS2ENVIRONMENT")
     24
    225'@echo off'
    326
    4 /* This script is executed before the Samba daemons are actually started
    5    You may put arbitrary tasks in here. There are several task templates
    6    in here. Of these only the simple removal of previous logfiles is
    7    enabled by default */
    8    
    9 SMB_LOGS = value("SMB_LOGS",,"OS2ENVIRONMENT")
     27if ArchLogs = 1 then do /* Creative logfile archive */
     28    ok = SysMkDir(SMB_LOGS'\Archive')
     29    Archive = SMB_LOGS||'\Archive\'||date('s')||'-'||translate(time('n'),'-',':')||".zip"
     30    address cmd' zip -jmo9 'Archive' 'SMB_LOGS'\log.?mbd* 'SMB_LOGS'\log.winb*'
     31end
    1032
    11 /* Remove previous logfiles only */
    12 say 'Removing previous logfiles'
    13 address cmd' del 'SMB_LOGS'\log.?mbd* 2>NUL'
    14 address cmd' del 'SMB_LOGS'\log.winb* 2>NUL'
     33if DelLogs = 1 then do /* Remove previous logfiles only */
     34    say 'Removing previous logfiles'
     35    address cmd' del 'SMB_LOGS'\log.?mbd* 2>NUL'
     36    address cmd' del 'SMB_LOGS'\log.winb* 2>NUL'
     37end
    1538
    16 /* Yuri Darios Logfile archiving feature */
    17 /*
    18 ok = SysMkDir(SMB_LOGS'\Archive')
    19 Archive = SMB_LOGS||'\Archive\'||date('s')||'-'||translate(time('n'),'-',':')||".zip"
    20 'zip -jmo9 'Archive' 'SMB_LOGS'\log.?mbd* 'SMB_LOGS'\log.winb*'
    21  */
    2239
    23 /* Removal of transient tdb files feature
    24    Caution! Do not enable these, unless you know what you are doing! */
     40if SaveCfg = 1 then do /* Take config snapshot */
     41    ok = SysMkDir(ETC'\SmbBackup')
     42    Backup = ETC'\SmbBackup\smbcfg-'date('S')'-'right('0'||time('M'),4)
     43    address cmd' zip -rpo9 'Backup' 'ETC'\samba\* 'UNIXETC'\*pwd* 'UNIXETC'\*passw* -x 'ETC'\samba\*.zip >SmbBackup'
     44end
    2545
    26 /*   
    27 ok = SysFileDelete(SMB_LOCK||'\gencache.tdb')
    28 ok = SysFileDelete(SMB_LOCK||'\brlock.tdb')
    29 ok = SysFileDelete(SMB_LOCK||'\unexpected.tdb')
    30 ok = SysFileDelete(SMB_LOCK||'\connections.tdb')
    31 ok = SysFileDelete(SMB_LOCK||'\locking.tdb')
    32 ok = SysFileDelete(SMB_LOCK||'\messages.tdb')
    33  */
     46
     47if DelTDBs = 1 then do /* remove transient .tdb files */
     48    /* Documentation:
     49       http://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/tdb.html
     50     */
     51    ok = SysFileDelete(SMB_LOCK||'\brlock.tdb')
     52    ok = SysFileDelete(SMB_LOCK||'\browse.dat')
     53    ok = SysFileDelete(SMB_LOCK||'\connections.tdb')
     54    ok = SysFileDelete(SMB_LOCK||'\gencache.tdb')
     55    ok = SysFileDelete(SMB_LOCK||'\locking.tdb')
     56    ok = SysFileDelete(SMB_LOCK||'\login_cache.tdb')
     57    ok = SysFileDelete(SMB_LOCK||'\messages.tdb')
     58    ok = SysFileDelete(SMB_LOCK||'\sessionid.tdb')
     59    ok = SysFileDelete(SMB_LOCK||'\unexpected.tdb')
     60    ok = SysFileDelete(SMB_LOCK||'\winbindd_cache.tdb')
     61    ok = SysFileDelete(SMB_LOCK||'\wins.dat')
     62    /* Do not remove wins.tdb unless it is damaged */
     63    ok = SysFileDelete(SMB_LOCK||'\wins.tdb')
     64end
     65
     66if WaitDHCP then do /* Make sure we got network interfaces up and running */
     67    address cmd' dhcpstrt'
     68end
    3469
    3570say 'b4smb done.'
  • branches/scripts/smb_init/smb.cmd

    r761 r844  
    1 /* Samba Server for eCS (OS/2) init script Version 3.1.7
     1/* Samba Server for eCS (OS/2) init script Version 3.1.8
    22   Copyright (C) netlabs.org 2007-2012
    33
     
    497497        if left(smbline,1) = '[' then do /* new section */
    498498            parse var smbline '['sname']'
    499             sname = translate(strip(sname),'_!?',' :$')
     499            sname = translate(strip(sname),'__!?',' *:$')
    500500            s = s + 1
    501501            sections.0 = s
     
    505505        else do /* new parm */
    506506            parse var smbline parm'='pvalue
    507             parm = translate(strip(parm),'_!?',' :$')
     507            parm = translate(strip(parm),'__!?',' *:$')
    508508            pvalue = strip(pvalue)
    509509            p = p + 1
     
    511511                then istr = sname"."parm"='"pvalue"'"
    512512                else istr = sname'.'parm'="'pvalue'"'
     513            signal on syntax name nextone
    513514            interpret istr
    514515            istr = sections.s'.'p'="'parm'"'
     
    516517            istr = sections.s'.0='p
    517518            interpret istr
     519            nextone:
    518520        end
    519521    end
Note: See TracChangeset for help on using the changeset viewer.