Batch file on network drive only works on some machines

Page 2 of 3 FirstFirst 123 LastLast

  1. Posts : 11
    Windows 10
    Thread Starter
       #11

    zebal said:
    If it's indeed syntax error then that's the syntax:


    However your command is not according to the syntax:


    It should be:


    Other than this I see no other issues from information you gave so far.
    It's difficult to know because cause it's completely unknown.
    I've tried working with the syntax and nothing made any difference. This syntax works. It's not the syntax. Something in Windows is preventing the scripts from running.
      My Computer


  2. Posts : 1,746
    Windows 10 Pro x64 22H2
       #12

    Leora said:
    I've tried working with the syntax and nothing made any difference. This syntax works. It's not the syntax. Something in Windows is preventing the scripts from running.
    Here are few suggestions, on a computer which is having this issue:
    1. Open services.msc as Admin and restart "Function Discovery resource publication" (FdRedPub) service and try again
    2. Check if you can access Z drive from Windows explorer
      My Computer


  3. Posts : 776
    Windows 7
       #13

    If you read the actual AWS docs, it says "awstats.pl -config=[website domain]"...
      My Computer


  4. Posts : 11
    Windows 10
    Thread Starter
       #14

    zebal said:
    Is it possible to post code of your batch script which is run by task scheduler?
    Only relevant portion including line breaks
    This is the complete first block of the batch job. All subsequent blocks are the same, just changing the site name. There are 181 blocks in the batch job.

    REM Brookside Stats

    z:
    cd\webroot\brookside\logs

    copy access.log process.log
    del /Q brookside.log
    del /Q *.tmp

    findstr /I "brookside" process.log >process.tmp
    findstr /V "reports" process.tmp >brookside.log

    cd\awstats\wwwroot\reports
    del /Q *.*

    c:\perl64\bin\perl z:/awstats/tools/awstats_buildstaticpages.pl -awstatsprog=z:/awstats/wwwroot/cgi-bin/awstats.pl -update -config=brookside -dir=z:/awstats/wwwroot/reports/
    z:
    cd\awstats\wwwroot\reports
    ren awstats.brookside.html index.html
    copy *.* z:\webroot\brookside\reports\brookside
      My Computer


  5. Posts : 1,746
    Windows 10 Pro x64 22H2
       #15

    Looks fine except -update is before -config which is not what the script reports as "syntax"

    Anyway, what's the result of my post #12
      My Computer


  6. Posts : 11
    Windows 10
    Thread Starter
       #16

    garlin said:
    If you read the actual AWS docs, it says "awstats.pl -config=[website domain]"...
    The config does equal the website name which is also the name of the config file.

    - - - Updated - - -

    zebal said:
    Here are few suggestions, on a computer which is having this issue:
    1. Open services.msc as Admin and restart "Function Discovery resource publication" (FdRedPub) service and try again
    2. Check if you can access Z drive from Windows explorer
    When this service is restarted Z: is still accessible from both CMD and Explorer as it should be. It has no affect on the batch job failure.

    The drive is mapped correctly for the SYSTEM Account and the Local Account at the same time. The most sensitive process dependent on this drive mapping is Apache web server. If the drive was is not mapped for both SYSTEM and Local Account, the web service would not start because it would be unable to find the root directories specified in httpd.conf. Apache server starts fine on all 8 machines. I also have XLight FTP servers which are also dependent on data on Z:. The FTP servers work fine on all 8 machines.

    Changing where -update is in the command line did not have an affect. It works on the machines it works on, it doesn't work on the machines that fail.

    Everything on my network works exactly as expected and intended except for this one batch file on 5 of the 8 machines.
      My Computer


  7. Posts : 776
    Windows 7
       #17

    Regardless of permissions, I see a race condition if you have multiple servers accessing the same \awstats\wwwroot\reports, and running "del *.*" in parallel. Shouldn't each of the domains get their own temp folder, so there's no conflict?

    I presume you're scheduling the report simultaneously on all 8 machines.
      My Computer


  8. Posts : 11
    Windows 10
    Thread Starter
       #18

    garlin said:
    Regardless of permissions, I see a race condition if you have multiple servers accessing the same \awstats\wwwroot\reports, and running "del *.*" in parallel. Shouldn't each of the domains get their own temp folder, so there's no conflict?

    I presume you're scheduling the report simultaneously on all 8 machines.
    No, I'm not. Only 1 of the 8 machines runs the reports. I am working to fix a known problem now because it could come to pass in the future that I have no machines capable of running my reports and no ability to duplicate what currently works.
      My Computer


  9. Posts : 295
    Windows 10 Pro
       #19

    What doesn't work is my AWSTats report batch file. It works fine on 3 of the 8 machines, two of which are Windows 10.
    This command line fails on 5 of the 8 machines with a syntax error, but AWStats is not telling me what the error is.
    Does not compute.


    On the surface it seems maybe it's a permission issue. Just for "giggles" add all this crap above your batch code, then manually fire off your batch code and see if the stats and logs are generated.

    Code:
    @echo off
    
    :: BatchGotAdmin
    :-------------------------------------
    REM  --> Check for permissions
        IF "%PROCESSOR_ARCHITECTURE%" EQU "amd64" (
    >nul 2>&1 "%SYSTEMROOT%\SysWOW64\cacls.exe" "%SYSTEMROOT%\SysWOW64\config\system"
    ) ELSE (
    >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
    )
    
    REM --> If error flag set, we do not have admin.
    if '%errorlevel%' NEQ '0' (
        echo Requesting administrative privileges...
        goto UACPrompt
    ) else ( goto gotAdmin )
    
    :UACPrompt
        echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
        set params= %*
        echo UAC.ShellExecute "cmd.exe", "/c ""%~s0"" %params:"=""%", "", "runas", 1 >> "%temp%\getadmin.vbs"
    
        "%temp%\getadmin.vbs"
        del "%temp%\getadmin.vbs"
        exit /B
    
    :gotAdmin
        pushd "%CD%"
        CD /D "%~dp0"
    :--------------------------------------
    Just a shot in the dark here. Maybe there's a NetBIOS issue of some sorts.
      My Computer


  10. Posts : 295
    Windows 10 Pro
       #20

    *I got said "crap" from StackExchange and it works for me. LOL!
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 13:54.
Find Us




Windows 10 Forums