Back to Index

Programmatically controlling the scheduler

There are various methods available to control the Automize scheduler engine from your programs

1) Need to run Automize tasks only.  Use the TaskRunner feature from the Automize user interface to generate the commandline code.  Then use this code in your batch files, unix scripts, java exec function, c/c++ exec/spawn functions etc... to run the tasks.  The task will return an exit code that can be used in your programs for conditional processing.  Please see the help file on Exit Codes for details.

2) Full control of engine via commandline module:  Adding, modifying, suspending the tasks/schedules, start/stop the engine, or run tasks, and many more features are available via the commandline module.  You would have to format and send the desired commands via the commandline module using your program.  Please use the commandline module manually to see how it works, before trying to program through it.  This is the recommended method of programatically controlling the scheduler engine

3) Manually parse the data files and send socket commands to the engine server: Here you would manually write the task data or schedule data to the required data files, and then send a socket command to the engine server to load the data or run tasks etc..  This is the more difficult approach and is not recommended.  Method 2, does this automatically for you.
The task data is in the file ..Automize/inputs/taskData.jsd
The schedule data is in the file ..Automize/inputs/scheduleData.jsd


The engine server understands the following socket commands:
ConfirmRunning
ShutdownEngine
RunTask^Tasktitle
ReloadTaskData
ReloadScheduleData
ReloadRegSettings
ReloadUserSettings

The following is an example to send socket command to the server using java.  The command is a simple string denoted by msg, where msg = "ReloadTaskData" etc...

public static boolean sendEngineServerMsg(String msg)
{
       try
      {
           Socket s = new Socket("localhost",enginePort);  //enginePort = 1965 for version 5.x
           PrintStream ps = new PrintStream(s.getOutputStream());
           ps.println(msg);
           ps.flush();
           s.close();
           return true;
      }
      catch(Exception e)
      {
           String err = "Scheduler engine is either shut down or is not responding";
            // Output (err);
           return false;
      }
}