3 Replies Latest reply: Apr 8, 2013 8:49 AM by Nick Gan RSS

    EXECUTE CMD -out log permissions

    David Norton

      Hi Everyone,


      Which account/trustlevel does the EXECUTE command default to when running a CMD operation?  What is the simplest way to override that with Admin rights?


      I'm finishing up a batch reloader, which reloads several apps (for group scheduling from QVS), then checks the log files of the apps it reloads to see if they reloaded successfully.  It works like a charm on local and test machines, but runs into write permissions when pushed to a client box.  The client's IT guy says our login has admin rights, but the following EXECUTE command is unable to write the output log file, even to an output folder that the script itself created:

      EXECUTE cmd.exe /c cd "C:\Program Files\QlikView\Distribution Service\" &&QVDistributionService -r="D:\Data\ExampleApp.qvw" -out="d:\Data\logs\ExampleApp.log"

      Also, any existing log files cannot be overwritten, so seeding the directory ahead of time with pre-created files is out.


      The other piece is that I'm able to grab this parsed line from the (failed) batch reloader's log, paste it exactly into a CMD window, and it runs just fine, including creating the log file.  So, my account does have proper credentials, but the rights change when the script runs its EXECUTE commands.


      I've tried numerous methods to open up writes for these folders to all authenticated users, and have opened up security within the QV app, including System Access, etc...  and am just spinning at this point.


      Any help you can provided would be greatly appreciated.




        • Re: EXECUTE CMD -out log permissions
          David Norton

          I'm looking into RUNAS, but working the password into it could be problematic, due to either manual input or security concerns if I need to expose it somewhere.

            • Re: EXECUTE CMD -out log permissions
              David Norton

              Looks like it's just unusual syntax required here.  What's missing is that the entire DOS command needs to be wrapped in double-quotes, regardless of quotations inside the command, because these outer quotes are then NOT passed to the CMD window.


              So...  I needed a generated command like this:

              EXECUTE cmd.exe /c cd ""C:\Program Files\QlikView\Distribution Service\" &&QVDistributionService -r="D:\Data\ExampleApp.qvw" -out="d:\Data\logs\ExampleApp.log""

              And, actually, I don't need to change directories first, so the following is more streamlined:

              EXECUTE cmd.exe /c ""C:\Program Files\QlikView\Distribution Service\QVDistributionService" -r="D:\Data\ExampleApp.qvw" -out="d:\Data\logs\ExampleApp.log""

              This syntax issue was so minor, but I just didn't see it in any discussions or documentation I found.


              Either way, fixed.

            • Re: EXECUTE CMD -out log permissions



              Now i face some weird error.


              If i schedule the qvw which contacnt the command to exec, it failed to reload the qvw,.


              but if i open by QV desktop and reload manually, it works.


              What could be the error?


              I took a look in the log, it says this ....


              i dont know why there's E:\TEMP,... it doesnt exist at all....


              Any ideas ? Thanks.


              4/8/2013 2:02:33 PM      Error     Exception=System.IO.DirectoryNotFoundException: Could not find a part of the path 'E:\TEMP\rdko40q4.tmp'.

                 at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)

                 at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath)

                 at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)

                 at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)

                 at System.CodeDom.Compiler.TempFileCollection.EnsureTempNameCreated()

                 at System.CodeDom.Compiler.TempFileCollection.AddExtension(String fileExtension, Boolean keepFile)

                 at System.CodeDom.Compiler.CodeCompiler.FromSourceBatch(CompilerParameters options, String[] sources)

                 at System.CodeDom.Compiler.CodeCompiler.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromSourceBatch(CompilerParameters options, String[] sources)

                 at SolutionGlobal.Compilers.JScriptCompiler.Compile(String i_Source, Action`1 i_ErrorDelegate)

                 at QDSMain.LoadBalancer.Config_ConfigChangedEvent()

                 at QDSMain.LoadBalancer..ctor()

                 at QDSMain.ObjectPool.InitObjects(ILogBucket i_LogBucket, eRunLevel i_RunLevel, Func`1 clusterIDListGetFunc)

                 at QDSMain.MainClass.BatchRun(eBatchReloadMode i_BatchReloadMode, String i_BatchReloadDocumentPath, String i_VariableName, String i_VariableValue)

              4/8/2013 2:02:33 PM      Information        Setting exit code to the number of errors. ErrorCount=1