autorelay - A quick and dirty way to relay events from one AutoSys instance to another, e.g. from PROD to DEV...
autorelay [options]
Specify the name of the configuration file to be loaded. If not specified, "./autorelay.conf" will be assumed.
Forces events to be sent, even if the given job's status was last changed before starting this script.
Print a brief help message and exits.
Prints the manual page and exits.
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.
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:
This section currently only supports one attribute:
As the name implies, this specifies the number of seconds to sleep between polls. If ommited, a default of 60 seconds is taken.
In this section one can define the database connections used to monitor status changes in AutoSys jobs. This section can contain the following attributes:
Specifies the DSN to connect to, e.g. dbi:Sybase:server=AUTOSYS_DEV;database=autosysdb
AutoSys' database user, defaults to "autosys".
Password of above user, defaults to "autosys".
In this section one can define jobs and their mutual dependencies. This section can contain the following attributes:
This must be the name of a previously defined database.
This must be the name of another defined job. Use this attribute, when you want to make the current job dependant on another one.
This should be a valid AutoSys status name - see CA::AutoSys for valid status names.
When defining a script based job, place the full pathname to the appropriate script here. Environment variables are not yet expanded, sorry...
[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
Sinisa Susnjar <sini@cpan.org>
To install CA::AutoSys, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CA::AutoSys
CPAN shell
perl -MCPAN -e shell install CA::AutoSys
For more information on module installation, please visit the detailed CPAN module installation guide.