Running Birst Connect Tasks using a Scheduler

Use an operating system scheduler to schedule regular extract tasks using Birst Connect. For example, use Cron for Unix or Linux and Task Scheduler for Windows. Schedule Birst Connect tasks using Java or Javaws.

Important: Do not use the scheduler tab in Birst Connect as it is deprecated.

Tip: Once a scheduler starts Birst Connect, the scheduler cannot stop the tasks.

Using Java

To use Java to schedule Birst Connect tasks

1. To use Java you need library files contained in BirstConnect.zip. Go to Admin - Define Sources - Birst Connect and click the Download (BirstConnect.zip) link.
2. Save the lib files to a folder of your choice on your local network where your RDBMS resides.
3. Define your Birst Connect tasks. See Using Birst Connect.
4. After your tasks are defined, launch Birst Connect again and save the SpaceId.jnlp file to the folder you chose in step 2.
5. Rename the .jnlp file to something meaningful, for example, DevSpaceDefault.jnlp or ProdSpaceCust.jnlp. This file will be referenced in the bash or batch file. 
Important: The .jnlp files generated from different configurations will have the same name. If you use more than one configuration, save one at a time and rename each to something appropriate.  
6. Create a bash or batch file (for example, run_java.bat) with the following commands. Substitute your RDBMS jar file, .jnlp file name and task name.

java -cp "DataConductor.jar;log4j-1.2.15.jar;sqljdbc.jar" -Djnlp.file=DevSpaceDefault.jnlp com.birst.dataconductor.DataConductorCommandLine -tasks MyTaskName

Referencing the .jnlp file in the bash or batch file simplifies the bash or batch file. The .jnlp file includes the URL, username, configuration name, space name, and encrypted password making it unnecessary to copy all of those items into the bash or batch file.

Tip: You can run multiple tasks separated by commas and task names can have spaces. For example:
-tasks MyTaskName1, MyTaskName2 WithSpace, MyTaskName3
7. Use Windows Scheduler or create a Cron job to define and run a schedule that executes the batch file. If an error occurs, Birst Connect returns a non-zero error code. This error code can be used to implement a retry loop (for example, after a 2 minute delay).

Tip: When you upgrade to a new version or change passwords on the account you are using to log into Birst Connect, generate a new .jnlp file and copy it over the existing one.

Example Linux Bash Shell Script that Executes Birst Connect Command Line

The following example executes a Birst Connect Task and looks for any error codes in the client execution. This includes file compression and client-server communication errors. Any processing error on the server after the task kickoff has completed will be handled by the normal email notification process of Birst.

/******************** START OF birstconnect.sh *********************/

#!/bin/bash

# set script variables

# NOTE: this script uses a parameter ($1) to pass in the task name

#export JAVA_HOME=/usr/java/jdk1.8.0_65

export SCRIPT_HOME=/home/username/BirstConnect

export CLASSPATH="$SCRIPT_HOME/dist/lib/*:$SCRIPT_HOME/dist/DataConductor.jar:./"

# NOTE: uncomment the export display line if needed to adjust for a headless server

# Display is set to :1 because Xvfb is running as server 1.  This must match what server number Xvfb is running under.

# export DISPLAY=:0

# NOTE: Uncomment this line to show environment

#env

# this is the java call to load the tasks from the task manager

# Add path to jnlp file downloaded for the space in Birst.

java -Djava.awt.headless=false -classpath $CLASSPATH -Djnlp.file="$SCRIPT_HOME/BirstConnect.jnlp" -Xmx1024m com.birst.dataconductor.DataConductorCommandLine -tasks "$1"

#-- uncomment the following command line if want to make this script call the task manager, a display is needed

#-- $JAVA_HOME/bin/java -Djava.awt.headless=false -classpath $CLASSPATH -Djnlp.file="$SCRIPT_HOME/BirstConnect.jnlp" -Xmx1024m com.birst.dataconductor.DataConductorApp

Example Windows Batch Script that Executes Birst Connect Command Line

The following example executes a Birst Connect Task and looks for any error codes in the client execution. This includes file compression and client-server communication errors. Any processing error on the server after the task kickoff has completed will be handled by the normal email notification process of Birst.

set JAVA_HOME=C:\Program Files\Java\jre8

set BirstConnect_Home=c:\BirstConnect

:begin

@echo off

"%JAVA_HOME%\bin\java" -cp "%BirstConnect_Home%\dist\*;%BirstConnect_Home%\dist\lib\*" -Djnlp.file=TestBCNorthwind.jnlp com.birst.dataconductor.DataConductorCommandLine -tasks TestBCLoad

if not errorlevel 0 goto bcerror

:bcsuccess

echo Successful Birst Connect Execution

echo Don't send an alert here...

exit

:bcerror

echo Task Execution Failed

echo Send an Alert Here!!

Exit

Using Javaws

Birst Connect requires a JVM (Java 8 is recommended) to be installed on the machine from which Birst Connect is launched.

To run a Birst Connect task using Windows Scheduler or a Unix Cron job

  1. Go to Admin - Define Sources - Birst Connect.
  2. On the Birst Connect page, click Launch next to the Default configuration or next to the configuration you would like to use.
  3. Click Save when prompted to open or save a .jnlp file from Birst and save the .jnlp file to a destination of your choice.
  4. To execute a task via the command line:

    javaws -open task_name jnlp_name.jnlp

    For example, to run a task called Product Data defined for a space named Northwind:

    javaws -open "Product Data" Northwind.jnlp
  5. To schedule a task using Windows Scheduler, create a batch file (a text file with the file ending .bat) with the command as its content. Add a new Windows scheduled task and point to the batch file as the program you want Windows to run.

See Also
Using Infor Connect
Running Birst Connect UI from the Command Line
Birst Connect Command Files