Automic Workload Automation

  • 1.  Killing an executable when a job that triggered it is cancelled

    Posted Nov 18, 2016 04:58 PM
    The windows job will only execute/trigger a command 
    (eg: run *.bat, start an exe file etc) and it does not get the PID back from the process it triggered.
    Because of this, it will not abort the process it triggered if the windows job gets cancelled.

    A workaround would be to have a script or job (in this case, windows job) that will kill the executable if JOBS.*** is cancelled (status <> ANY OK).

    In the Post-Process tab of the job, you can activate the script/job that will kill the process:
    :set &act# = activate_uc_object(JOBS.WIN.TASKKILL)


    Below is a sample command  that is in JOBS.WIN.TASKKILL that will abort Chrome.exe if JOBS.*** is cancelled.

    taskkill /F /IM chrome.exe 


    *Note that this is just one example. There are other ways to cancel an executable. 



  • 2.  Killing an executable when a job that triggered it is cancelled

    Posted Nov 18, 2016 06:25 PM
    You can write a script as well that will get the PID of the executable that is running, and kill the process using the PID.

    If you don't want to write a script to kill the executable, another way is: 
    1) start Service Manager using an account that is not "local system"
    2) make sure that account has all the privileges mentioned here:
    https://automic.force.com/support/apex/CommunityArticleDetail?id=ka4b00000004M6n
    3) stop/start service manager
    4) open your windows job. On [WINDOWS] tab, under Job object, select Yes
    5) when you run windows job and it gets cancelled, the executable should get cancelled as well




  • 3.  Killing an executable when a job that triggered it is cancelled

    Posted Nov 18, 2016 06:37 PM
    In what scenarios is this necessary?

    I thought that if my WINDOWS job starts an exe and I cancel it, the exe is also cancelled automatically?


  • 4.  Killing an executable when a job that triggered it is cancelled

    Posted Nov 18, 2016 09:56 PM
    In addition to the setting on the JOBS Windows tab you can set the agent configuration to turn it on by default. 

    https://docs.automic.com/documentation/webhelp/english/ALL/components/AE/11/All%20Guides/help.htm#ucaari.htm%3FTocPath%3DAdministration%2520Guide%7CConfiguration%7CStructure%2520of%2520the%2520Configuration%2520Files%7CAgents%7C_____13

    The setting is useJobObject, set to 1 or 0. I'm not sure why you'd ever want it on 0 really, but that is the default setting. If you cancel a windows job with this turned off you get an error when the agent tries to clean up the JCL:
    11/18/2016 5:46:50 PM -  U00029006 File 'C:\uc4\Agents\Windows\TEMP\OAAYLWXQ.TXT' cannot be deleted, error code '32', error description: '32 - The process cannot access the file because it is being used by another process.'.
    11/18/2016 5:46:50 PM -  U00011054 Job 'JOBS.WIN.MIKE' (RunID  '0011176246') on Host 'C301DEVOPSUT1' terminated with CANCEL. Remote ID=7080 

    To see the effect, make a windows job that is long running (ping -n 300 localhost), run it, pull up the task manager on the host you ran it against and find your ping in the list of processes. Now go cancel the JOBS, and check whether the ping is still running.