The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

autorelay - A quick and dirty way to relay events from one AutoSys instance to another, e.g. from PROD to DEV...

SYNOPSIS

autorelay [options]

OPTIONS

--config cfg-file

Specify the name of the configuration file to be loaded. If not specified, "./autorelay.conf" will be assumed.

--force

Forces events to be sent, even if the given job's status was last changed before starting this script.

--help

Print a brief help message and exits.

--man

Prints the manual page and exits.

DESCRIPTION

This program will relay AutoSys events from one instance (e.g. PROD) to another one (e.g. DEV). Additionally, it can start shell scripts based on the outcome of AutoSys jobs, or start AutoSys jobs based on the outcome of shell scripts. It can also start a shell script based on shell scripts. Please be aware that when you make an AutoSys job dependend on a shell script, the AutoSys job will be triggered each time the shell script returns with an exit code of 0. One can also make one shell script depend on the outcome of another - the same applies as above.

CONFIG FILE SYNTAX

The program autorelay uses the module Config::IniFiles - see it's POD for the general syntax of the config file. Sections are used to define general options, database connections, or dependencies between jobs. A job can either be an AutoSys job or a script. When defining a dependency on an AutoSys job, one has at least to specify the DATABASE attribute. Depending on circumstances, one also may have to define the DEPENDS and EVENT attributes as well. A job that consists of a script needs the SCRIPT attribute. The following sections are currently understood:

[CONFIG]

This section currently only supports one attribute:

POLLTIME = secs_between_polls

As the name implies, this specifies the number of seconds to sleep between polls. If ommited, a default of 60 seconds is taken.

[DATABASE db_name]

In this section one can define the database connections used to monitor status changes in AutoSys jobs. This section can contain the following attributes:

DBI_DSN = dsn

Specifies the DSN to connect to, e.g. dbi:Sybase:server=AUTOSYS_DEV;database=autosysdb

DBI_USER = user

AutoSys' database user, defaults to "autosys".

DBI_PASS = pass

Password of above user, defaults to "autosys".

[JOB job_name]

In this section one can define jobs and their mutual dependencies. This section can contain the following attributes:

DATABASE = db_name

This must be the name of a previously defined database.

DEPENDS = job_name

This must be the name of another defined job. Use this attribute, when you want to make the current job dependant on another one.

EVENT = status_name

This should be a valid AutoSys status name - see CA::AutoSys for valid status names.

SCRIPT = script_name

When defining a script based job, place the full pathname to the appropriate script here. Environment variables are not yet expanded, sorry...

EXAMPLE CONFIG

    [CONFIG]
    POLLTIME =  30

    [DATABASE DEV]
    DBI_DSN =   dbi:Sybase:server=AUTOSYS_DEV;database=autosysdb

    [DATABASE PROD]
    DBI_DSN =   dbi:Sybase:server=AUTOSYS_PROD;database=autosys

    [JOB UPLOAD_DEV]
    DATABASE =  DEV
    DEPENDS =   UPLOAD_PROD
    EVENT =     SUCCESS

    [JOB UPLOAD_PROD]
    DATABASE =  PROD

    [JOB PREPARE_DATA]
    DATABASE =  DEV
    DEPENDS =   CHECK_STATUS

    [JOB CHECK_STATUS]
    SCRIPT =    /home/sini/etc/check_status.sh

AUTHOR

Sinisa Susnjar <sini@cpan.org>