Changeset 266 for branches/scripts


Ignore:
Timestamp:
Jun 13, 2009, 5:36:52 PM (16 years ago)
Author:
Herwig Bauernfeind
Message:

smb.cmd: Add support for Samba 3.3.x

Location:
branches/scripts/smb_init
Files:
2 edited

Legend:

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

    r193 r266  
    44/* This script is executed before the Samba daemons are actually started
    55   You may put arbitrary tasks in here. There are several task templates
    6    in here here. Of these only the simple removal of previous logfiles is
     6   in here. Of these only the simple removal of previous logfiles is
    77   enabled by default */
    88   
     
    1010
    1111/* Remove previous logfiles only */
    12 say 'Remove previous logfiles'
     12say 'Removing previous logfiles'
    1313address cmd' del 'SMB_LOGS'\log.?mbd* 2>NUL'
    1414address cmd' del 'SMB_LOGS'\log.winb* 2>NUL'
  • branches/scripts/smb_init/smb.cmd

    r251 r266  
    1 /* Samba Server for eCS (OS/2) init script Version 3.0.2
     1/* Samba Server for eCS (OS/2) init script Version 3.0.3
    22   Copyright (C) netlabs.org 2007-2009
    33
     
    1616   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
    1717
    18    Description: Starts and stops the Samba smbd and nmbd
     18   Description: Starts and stops the Samba smbd, nmbd and winbindd
    1919                daemons used to provide CIFS/SMB network services.
    2020                Run without parameter in order to display usage!
     
    3535call directory samba.!bin
    3636
    37 /* Check if winbindd daemon exists */
    38 HaveWinbindd = (stream(samba.!bin'\winbindd.exe', 'c', 'query exists') <> "")
    39 
    4037/* get the commandline arguments */
    4138arg UArg Service
    4239
    43 /* Samba 3.3.x already supported! */
     40/* ALL is valid for Samba 3.3.x or better */
    4441if Service = "ALL" then Service = ""
     42
     43/* Set delay to wait when daemons come up or shutdown */
     44options.!delay = 1 /* sec */
    4545
    4646if \(Service = "") & \(Service = "SMBD") & \(Service = "NMBD") & \(Service = "WINBINDD") then do
     
    201201        exit -2
    202202    end
     203
     204    /* Check if winbindd daemon exists */
     205    HaveWinbindd = (stream(samba.!bin'\winbindd.exe', 'c', 'query exists') <> "")
    203206return
    204207
     
    275278
    276279    if running.!smbd = 1 & (svc = "SMBD" | svc = "") then do
    277         'smbcontrol smbd shutdown >' samba.!log_path'\log.smbd.shtdn 2>&1'
    278         ok = SysFileDelete(ETC'\samba\pid\smbd.pid')
    279         ok = SysSleep(0.1)
     280        samba.!bin'\smbcontrol.exe smbd shutdown >' samba.!log_path'\log.smbd.shtdn 2>&1'
     281        ok = SysFileDelete(ETC'\samba\pid\smbd*pid')
     282        ok = SysSleep(options.!delay)
    280283        ok = _SambaRunning()
    281284        if words(pids.!smbd) > 0 then do I = 1 to words(pids.!smbd)
    282             call charout ,"Trying to kill smbd.exe PID "word(pids.!smbd,I)
     285            call charout ,"Killing smbd.exe PID "word(pids.!smbd,I)
    283286            ok = PRKillProcess("1", word(pids.!smbd,I))
    284287            if ok = 0 then say ", success!"; else say ", error "ok
     
    287290
    288291    if running.!nmbd = 1 & (svc = "NMBD" | svc = "") then do
    289         'smbcontrol nmbd shutdown >' samba.!log_path'\log.nmbd.shtdn 2>&1'
    290         ok = SysFileDelete(ETC'\samba\pid\nmbd.pid')
    291         ok = SysSleep(0.1)
     292        samba.!bin'\smbcontrol.exe nmbd shutdown >' samba.!log_path'\log.nmbd.shtdn 2>&1'
     293        ok = SysFileDelete(ETC'\samba\pid\nmbd*pid')
     294        ok = SysSleep(options.!delay)
    292295        ok = _SambaRunning()
    293296        if words(pids.!nmbd) > 0 then do I = 1 to words(pids.!nmbd)
    294             call charout ,"Trying to kill nmbd.exe "word(pids.!nmbd,I)
     297            call charout ,"Killing nmbd.exe PID "word(pids.!nmbd,I)
    295298            ok = PRKillProcess("1", word(pids.!nmbd,I))
    296299            if ok = 0 then say ", success!"; else say ", error "ok
     
    299302
    300303    if running.!winb = 1 & (svc = "WINBINDD" | svc = "") then do
    301         'smbcontrol winbindd shutdown >' samba.!log_path'\log.winbindd.shtdn 2>&1'
    302         ok = SysFileDelete(ETC'\samba\pid\winbindd.pid')
    303         ok = SysSleep(0.1)
     304        samba.!bin'\smbcontrol.exe winbindd shutdown >' samba.!log_path'\log.winbindd.shtdn 2>&1'
     305        ok = SysFileDelete(ETC'\samba\pid\winbindd*pid')
     306        ok = SysSleep(options.!delay)
    304307        ok = _SambaRunning()
    305308        if words(pids.!winb) > 0 then do I = 1 to words(pids.!winb)
    306             call charout ,"Trying to kill winbindd "word(pids.!winb,I)
     309            call charout ,"Killing winbindd PID "word(pids.!winb,I)
    307310            ok = PRKillProcess("1", word(pids.!winb,I))
    308311            if ok = 0 then say ", success!"; else say ", error "ok
    309312        end
    310313    end
    311     ok = SysSleep(0.2)
     314    ok = SysSleep(options.!delay)
    312315    if \_SambaRunning() then say Green||"Samba "samba.!version" services stopped successfully."||Normal
    313316    else do
     
    367370    if running.!smbd = 0 & (svc = "SMBD" | svc = "") then do
    368371        /* Just to be sure - this pid file should not be there anyway! */
    369         ok = SysFileDelete(ETC'\samba\pid\smbd.pid')
     372        ok = SysFileDelete(ETC'\samba\pid\smbd*pid')
    370373        ok = charout(, '  SMBD:     ')
    371         'detach smbd'
     374        'detach 'samba.!bin'\smbd' /* Do not add .exe here!!! */
    372375    end
    373376    if running.!nmbd = 0 & (svc = "NMBD" | svc = "") then do
    374377        /* Just to be sure - this pid file should not be there anyway! */   
    375         ok = SysFileDelete(ETC'\samba\pid\nmbd.pid')
     378        ok = SysFileDelete(ETC'\samba\pid\nmbd*pid')
    376379        ok = charout(, '  NMBD:     ')
    377         'detach nmbd -l 'samba.!log_path' -d 'samba.!debugLevel
     380        'detach 'samba.!bin'\nmbd -l 'samba.!log_path' -d 'samba.!debugLevel
    378381    end
    379382    if haveWinbindd & running.!winb = 0 & (svc = "WINBINDD" | svc = "") then do
    380383        /* Just to be sure - this pid file should not be there anyway! */   
    381         ok = SysFileDelete(ETC'\samba\pid\winbindd.pid')
     384        ok = SysFileDelete(ETC'\samba\pid\winbindd*pid')
    382385        ok = charout(, '  WINBINDD: ')
    383         'detach winbindd -l 'samba.!log_path' -d 'samba.!debugLevel
    384     end
    385     ok = SysSleep(0.3)
     386        'detach 'samba.!bin'\winbindd -l 'samba.!log_path' -d 'samba.!debugLevel
     387    end
     388    ok = SysSleep(options.!delay)
    386389    if svc = "" then do
    387390        if _SambaRunning("ALL") then say Green||"Samba "samba.!version" services started successfully."||Normal
     
    453456return 0
    454457
    455 IniGet: /* Replacement IniGet routine to access the value a known parameter */
    456     iparm = translate(arg(1),'_',' ')
     458IniGet: /* Replacement IniGet routine to access the value of a known
     459           parameter */
     460    iparm = translate(arg(1),'_!',' :')
    457461    isection = arg(2)
    458462    /* Third parameter is ignored, as the file is not required here */
     
    461465    /* Deal with empty/non existing parameters */
    462466    if ivalue = translate(isection'.'iparm) then ivalue = ''
    463 return ivalue   
     467return ivalue
Note: See TracChangeset for help on using the changeset viewer.