Deployment Solution

 View Only
  • 1.  Job Dependency / Watch for Exit Code

    Posted Jun 05, 2009 08:29 AM

    I am trying to create a master Job that calls on a series of subsequent jobs to build a server.

    I can schedule the jobs using axsched.exe and this is fine however the issue i have is that some of these jobs have manual steps to be completed after the job. These i am handling with Custom Error Codes. What i want to achieve is for a job only to be scheduled once the previous one has completed successfully.

    Has anyone done this before. The easiest way i can see to do it is using the code from the ASDK is to watch for the exit code to be 0

    Therefore the VBS would schedule a job and then look at the table waiting for the error code for that script to be 0 and then schedule the next.

    Unfortunately my vbs isnt quite to this level so any code snippits would be appreciated either from getting error codes from Event_Schedule Table or scheduling jobs using tools in ASDK

    Thanks


  • 2.  RE: Job Dependency / Watch for Exit Code

    Posted Jun 09, 2009 01:27 AM
    See my comment here.

    https://www-secure.symantec.com/connect/forums/help-dc-vbs-script#comment-2482001

    If it still dosn't make sense let me know.

    Josh


  • 3.  RE: Job Dependency / Watch for Exit Code

    Posted Jun 09, 2009 08:43 AM
    I would prefer to capture the EXIT CODE in a variable.
    I'm slightly modifying JOSH's script as below:

    '==========================================
    dim filesys, i
    dim WSHShell
    Set filesys = CreateObject("Scripting.FileSystemObject")
    Set WSHShell = WScript.CreateObject("WScript.Shell")
    i = 0
    i = SCHEDULE JOB 1 [WSHShell.Run]
    'Execute JOB2 if EXIT CODE of JOB1 is 0
    If i = 0 Then
           i = SCHEDULE JOB 2 [WSHShell.Run]
           If i = 0 Then
                     'Execute JOB3 if EXIT CODE of JOB2 is 0
                     i = SCHEDULE JOB 3 [WSHShell.Run]
           else
                    WSHShell.quit(i)
           End if
    else
           WSHShell.quit(i)
    End If
    '==========================================

    Above script is not the complete script. Just to show how the logic will be. Let me know if you need any assistance.

    Thanks,
    Eshwar