Changeset 886 for branches


Ignore:
Timestamp:
May 24, 2015, 10:02:17 AM (10 years ago)
Author:
Herwig Bauernfeind
Message:

b4smb: Add backup rotation (Ticket #247)

File:
1 edited

Legend:

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

    r844 r886  
    22  Samba Server for eComStation (OS/2) tools
    33 
    4   (c) 2007-2014 Herwig Bauernfeind for bww bitwise works GmbH.
     4  (c) 2007-2015 Herwig Bauernfeind for bww bitwise works GmbH.
    55  Script:  B4SMB.CMD, requires REXX.
    66  Purpose: This script is executed before the Samba daemons are actually
     
    1313ArchLogs = 1 /* Move previous logfiles to archive (by Yuri Dario) */
    1414DelLogs  = 0 /* Remove previous logfiles only */
     15KeepGens = 5 /* Keep last 5 generations of log files, 0 = all */
    1516SaveCfg  = 1 /* Save a snapshot of the current Samba configuration */
    1617DelTDBs  = 1 /* Remove transient .tdb files */
     
    2930    Archive = SMB_LOGS||'\Archive\'||date('s')||'-'||translate(time('n'),'-',':')||".zip"
    3031    address cmd' zip -jmo9 'Archive' 'SMB_LOGS'\log.?mbd* 'SMB_LOGS'\log.winb*'
     32    if KeepGens > 0 then do /* Eventually purge old logfile archives */
     33        ok = SysFileTree(SMB_LOGS||'\Archive\*.zip',logarchs.,"FO")
     34        if logarchs.0 > KeepGens then do
     35            do I = 1 to (logarchs.0-KeepGens)
     36                address cmd' del "'logarchs.I
     37            end
     38        end
     39    end
    3140end
    3241
Note: See TracChangeset for help on using the changeset viewer.