Sunday, 17 August 2014

Scheduling job using CronTab ..

Why -- Lets assume a situation wherein you want to execute a particular job on a particular time every day, or on a specific time and day of a week. To do that you need to schedule that job; and there are number of tools available to do that.

Informatica provides you a scheduler to schedule a job. However, you can do same thing using CronJob which is a default scheduler provided by Unix.

How --  To validate how can we schedule a informatica job, lets follow below steps
  1. Create a simple mapping and workflow which you will going to schedule
  2. Create a simple shell script which will execute that workflow
  3. Verify if workflows are getting executed by running the #2 shell script
  4. Schedule same shell script which you created at #2 using CronTab
Shell Script -- Below is the simple shell script example to run a concurrent workflow on unix.

#! /bin/bash
/u01/app/informatica/server/bin/pmcmd startworkflow -service Zulmi -domain Domain_gogate -user Administrator -password magogate -folder MyWork -runInstance instance1 wf_m_conWorkflow 
/u01/app/informatica/server/bin/pmcmd startworkflow -service Zulmi -domain Domain_gogate -user Administrator -password magogate -folder MyWork -runInstance instance2 wf_m_conWorkflow 

Above shell script will execute workflow wf_m_conWorkflow which is configured to run concurrent workflows on multiple instances.

First verify if workflows are running by executing the shell script which you have created above.

CronTab entry --

41 * * * * . /etc/bashrc; /tmp/Software/Informatica/runConWorkflow.sh

Here,
  1. 41 signifies minutes (0 - 59) on which CronTab will execute the shell script which you have created
  2. * * * * signifies Hrs (0-23), day of month (1 - 31), month (1 - 12), day of week (0-6; sunday=0)
  3. . /etc/bashrc; -- you may need this if crontab gives any error related to classpath or missing file
  4. Actual shell scripts which needs to be scheduled
Here, above crontab entry will execute workflow on every 41 minutes in a hour, every day for a year.

#3 will very depends on your class path entries. Here in my case I have specified all environmental variables at /etc/bashrc instead of .provide file or a individual user.

No comments:

Post a Comment