8 Replies Latest reply: Jan 24, 2017 5:45 AM by Diego Perez RSS

    Publisher - Run task with execute command

    Diego Perez

      Hi all,

       

      I've been working in a project where I need to run a sub where I execute CMD to run an external app recursively as per a table generated in my QVW.

      The thing is, when I schedule that app to reload in my Publisher, it runs without errors, but apparently it won't run the external commands.


      I don't know what to do really, as all system access privileges and stuff is checked in the script and app...


      This is the Statement I have in my code that won't run... the thing is when I run the app manually, it works both with my account and with the service account used by the publisher server.

      So apparently it is not a folder/execution permission issue... !

       

       

      sub.jpg

      Any suggestions to run this as a task from Publisher?

          • Re: Publisher - Run task with execute command
            Diego Perez

            Hi Rob,

             

            thanks for getting in touch, we're running a clustered environment with version 11.20.12904.0 That is SR12 If I'm not wrong.

              • Re: Publisher - Run task with execute command
                Rob Wunderlich

                Are you aware of the new AllowExecuteCommand switch in SR11?

                Authorizing the Script EXECUTE Statement | Qlikview Cookbook

                I believe the default in SR11 is allow, and you didn't say your script was failing, so this is probably not the issue.

                 

                Do those bat files refer to drive letters or something that won't work in a service? Do you see any orphaned cmd.exe tasks in Task Manager on the server?

                 

                Can you try ECHO a message from the bat file to a file to see if the task is actually executing?

                 

                -Rob

                  • Re: Publisher - Run task with execute command
                    Diego Perez

                    Hi Rob,

                     

                    thanks for your suggestions. Apparently due to security settings, I was using network paths and that is not allowed when I launch cmd.exe in my server. It actually was not just that I was using paths to launch the stuff I needed, it is also the path where it starts as we use a network file share machine to store the qvw.

                     

                    When a cmd is launched from there, It tries to use that folder as it's starting point, but due to security settings, it takes you back to Windows directory.
                    Then, relative paths from there don't work as it's not your qvw folder so it won't work at all.
                    In addition to the starting folder for the CMD it's the network paths not being recognized properly when executing enything else, so fixed straight await with this:

                     

                    I just added an execute command at the beggining of the script to map to a drive the network path I wanted and after that I changed all paths to use that unit instead of network \\whatever paths

                     

                    execute cmd.exe c/ NET USE Z: "\\path"

                     

                    Now it works from Publisher without any problem at all.


                    I've searched for the AllowExecuteCommand in my settings.ini file and it's not there, but as you say in your useful blog post, it is by default set to 1 so I guess either I looked in the wrong place or it doesn't need to be declared in the settings file to be 1 as it's the default.

                     

                    Anyway. It's working now.

                     

                    Thanks!

                     

                    Edit: I'm marking my answer as correct so It appears as solved.

                      • Re: Publisher - Run task with execute command
                        Swapneel Golapkar

                        Hi @Diego Perez,

                        I am facing the same issue.

                        On my Qlikview server I have R installed, on the E drive I have the R script, which is being Called by a Batch file (ReloadR.bat)

                        In Qlikview Script I am using following:

                             EXECUTE cmd /C "E:\Project\R Analytics\ReloadR.bat";

                         

                        It works fine locally, but when used with Publisher, it completes running without running the batch file.

                         

                        All execution done on one server machine, nowhere are network paths being used.

                         

                        Please help.

                         

                        Thanks,

                        Swapneel

                • Re: Publisher - Run task with execute command
                  Peter Cammaert

                  I noticed that you are either using no path or a relative path to specify the location of your external executables. Try adding full path specifications (start with an existing drive letter, not one you mapped yourself).

                   

                  Best,

                   

                  Peter