Dataclay — Automating Digital Production
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Register
    • Login

    Multiple Command Line Calls with Shell Exec

    Scheduled Pinned Locked Moved
    Templater Event Scripts
    2
    4
    1.1k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • wst-shortyundefined
      wst-shorty
      last edited by

      I have a php site that takes in user fields and creates a json file. I then use a shell_exec call the templater powershell file with the following statement:

      shell_exec(‘powershell -File C:\render\templater.ps1 -v “CC 2017” -m’);

      However, when more than one person submits the form and a video is rendering the second call doesn’t work?

      Do you know why this would be? I have included the -m tag as well.

      Thanks

      ariestavundefined 1 Reply Last reply Reply Quote 0
      • ariestavundefined
        ariestav @wst-shorty
        last edited by

        @wst-shorty Hi There, and thanks for writing into the forums. I think the answer is that you need to run the Powershell launcher as a child or forked process in PHP. I’m not certain how to acheive this in PHP, but there are frameworks for handling child processes in PHP. See the following:

        https://icicle.io

        Have you tried using PHP’s exec() instead of shell_exec():

        You essentially need to make sure that PHP runs your command as a child process. On Windows, we’ve had success using SysInternals PsExec to run multiple instances of AfterFX.exe from an exec() command. Even though PsExec is intended for launching apps on remote machines, you can still use it to launch an app on the local machine.

        Please let me know if this helps in any way, it would be great to learn of your findings.

        Best,
        Arie

        wst-shortyundefined 1 Reply Last reply Reply Quote 0
        • wst-shortyundefined
          wst-shorty @ariestav
          last edited by

          @ariestav Yeah it seemed to have some weird conflict with PHP and windows running concurrently (its to do with how threading is coded). PsExec helped solve this though. Thanks very much!

          ariestavundefined 1 Reply Last reply Reply Quote 0
          • ariestavundefined
            ariestav @wst-shorty
            last edited by

            @wst-shorty You’re welcome! Thanks for following up and letting us know.

            1 Reply Last reply Reply Quote 0
            • First post
              Last post