5 Replies Latest reply on Aug 31, 2020 4:04 PM by Joe Goldberg

    Automatically hold a job.

    Steve Rathbun
      Share This:

      We would like to use a job, possibly file watcher, to be able to either hold or free another job. Is this possible is one form or another?

        • 1. Re: Automatically hold a job.

          You can write a custom script using the CTM utilities as a shout in the action of the job. From there you can supply the necessary information to instruct the script to hold the job. Using the jobname, if it is truely unique, you can use something like "holdscript.sh <jobname>" and then inside the script you will have to parse the results. Note that spaces in a jobname will not work very well unless you use quotations properly.


          Use ctmpsm to list all jobs, parse it using the jobname and a Windows/Linux command, then using the orderID obtained you can then call ctmpsm again to hold that job. I believe that's the best way to do it. Limit how often you call this function though, I've seen runaway scripts sit idle for over an hour when a custom script using this command was called >50 times only 15 min before newday.

          1 of 1 people found this helpful
          • 2. Re: Automatically hold a job.
            Mark Francome
            1 of 1 people found this helpful
            • 3. Re: Automatically hold a job.
              Joe Goldberg

              There are several methods for holding jobs. One of the considerations is when you wish to apply the hold. For example, you can request that a job is placed on Hold when it is ordered. Perhaps the most flexible method today is using Automation API. This approach enables you to hold a job form any host or application as long as the Enterprise Manager can be reached via REStful Web Services. This eliminates the need to be running on a machine with any Control-M components installed and without being bound to a specific instance of Control-M.


              Let me know if you need more detailed information.

              • 4. Re: Automatically hold a job.
                Steve Rathbun



                Yes, if you could supply details that would be beneficial. No we don't want to hold the job when it is ordered in as it's only on request once or twice a month to hold until it's requested to be freed.


                email srathbun@hastingsmutual.com

                • 5. Re: Automatically hold a job.
                  Joe Goldberg

                  Hi Steve,


                  Here's a bit more information:

                  • Create a file named HoldTrue.json (can be any name with a json extension) that looks like this:

                    { "hold": "true"}

                  • Order your folder like this:

                    ctm run order <Control-M/Server name> <Folder Name> -f HoldTrue.json
                  • The "-f" is a parameter file for the Order operation. You can specify options similar to the "Order" dialog from the Monitoring domain in the Workload Automation client.
                  • The above assumes you have installed and configured the "ctm" cli
                  • Documentation is available here: Automation API Home
                  • You can use REST instead of cli, you can write a script that builds the options file instead of having one statically pre-built. Let me know if this helps and would be very happy to discuss further.
                  1 of 1 people found this helpful