- Timestamp:
- Feb 12, 2014, 4:25:35 PM (12 years ago)
- 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 13 ArchLogs = 1 /* Move previous logfiles to archive (by Yuri Dario) */ 14 DelLogs = 0 /* Remove previous logfiles only */ 15 SaveCfg = 1 /* Save a snapshot of the current Samba configuration */ 16 DelTDBs = 1 /* Remove transient .tdb files */ 17 DHCPWait = 1 /* wait until an address was obtained by the DHCP server */ 18 19 /* Setup places */ 20 ETC = value("ETC",,"OS2ENVIRONMENT") 21 UNIXETC = value("UNIXROOT",,"OS2ENVIRONMENT")'\etc' 22 SMB_LOGS = value("SMB_LOGS",,"OS2ENVIRONMENT") 23 SMB_LOCK = value("SMB_LOCK",,"OS2ENVIRONMENT") 24 2 25 '@echo off' 3 26 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") 27 if 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*' 31 end 10 32 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' 33 if 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' 37 end 15 38 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 */22 39 23 /* Removal of transient tdb files feature 24 Caution! Do not enable these, unless you know what you are doing! */ 40 if 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' 44 end 25 45 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 47 if 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') 64 end 65 66 if WaitDHCP then do /* Make sure we got network interfaces up and running */ 67 address cmd' dhcpstrt' 68 end 34 69 35 70 say 'b4smb done.' -
branches/scripts/smb_init/smb.cmd
r761 r844 1 /* Samba Server for eCS (OS/2) init script Version 3.1. 71 /* Samba Server for eCS (OS/2) init script Version 3.1.8 2 2 Copyright (C) netlabs.org 2007-2012 3 3 … … 497 497 if left(smbline,1) = '[' then do /* new section */ 498 498 parse var smbline '['sname']' 499 sname = translate(strip(sname),'_ !?',':$')499 sname = translate(strip(sname),'__!?',' *:$') 500 500 s = s + 1 501 501 sections.0 = s … … 505 505 else do /* new parm */ 506 506 parse var smbline parm'='pvalue 507 parm = translate(strip(parm),'_ !?',':$')507 parm = translate(strip(parm),'__!?',' *:$') 508 508 pvalue = strip(pvalue) 509 509 p = p + 1 … … 511 511 then istr = sname"."parm"='"pvalue"'" 512 512 else istr = sname'.'parm'="'pvalue'"' 513 signal on syntax name nextone 513 514 interpret istr 514 515 istr = sections.s'.'p'="'parm'"' … … 516 517 istr = sections.s'.0='p 517 518 interpret istr 519 nextone: 518 520 end 519 521 end
Note:
See TracChangeset
for help on using the changeset viewer.