AutoSys Workload Automation

  • 1.  Sleep Command

    Posted Mar 04, 2013 01:51 PM
    I would like to enter on the command line (the job sleep for 20 seconds) and (then execute the *.bat file). I do not want to create 2 jobs.


  • 2.  RE: Sleep Command

    Posted Mar 05, 2013 09:21 AM
    Hi,

    It is not possbile to code in the command line itself, instead we can code sleep step in the .bat file itself. and supply .bat file path to the command attribute.


  • 3.  RE: Sleep Command

    Posted Mar 05, 2013 10:39 AM
    I thought so. Might add a sleep feature in the next WCC release. Thank you so much.


  • 4.  RE: Sleep Command

    Posted Mar 06, 2013 10:34 AM
    Few things are impossible. Some things just take more effort.

    I am assuming we are talking about windows jobs, as Unix/Linux you can just use the sleep command.

    You need to get creative with windows.

    http://www.robvanderwoude.com/wait.php

    Or you could even roll your own sleep command if your feeling ambitious.
    http://msdn.microsoft.com/en-us/library/windows/desktop/ms686298(v=vs.85).aspx

    That would be my choice. Something like...
    #include <iostream>
    #include <cstdlib>
    #include <windows.h>
    
    int main ( int argc, char* argv[] )
    {
        if( argc == 1 ){
            float secs = strtof(argc[0]);
            Sleep(int(secs * 1000)); // Number of secconds times 1000 == MiliSeconds
            return 0;
        }
    }
    (NOT tested, and does not have to many features)

    Anyway there are many options to chose from. Some suck, some suck less. so whatever you chose simply add this to your jobs command attribute.

    command: [SLEEP_COMMAND_YOU_CHOSE] && [COMMAND_YOU_WANT_TO_RUN]

    o also you will need to configure your remote agents with...

    oscomponent.cmdprefix.force=true

    This will cause the remote agent to stuff a "cmd /c" befor your command so the positive conditional will work (&&)

    hope that helps.