Sinisa Susnjar > CA-AutoSys-1.05 > CA::AutoSys

Download:
CA-AutoSys-1.05.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  1
View/Report Bugs
Module Version: 1.05   Source  

NAME ^

CA::AutoSys - Interface to CA's AutoSys job control.

This module was born out of the need to control some AutoSys jobs via a Perl/CGI script. It is sort of a quick hack, but it works for me... should you have some wishes / requirements that are not mentioned in "TODOs", please let me know.

SYNOPSIS ^

    use CA::AutoSys;

    my $hdl = CA::AutoSys->new( [OPT] ) ;
    my $jobs = $hdl->find_jobs($jobname) ;
    while (my $job = $jobs->next_job()) {
        :
    }
    my $status = $job->get_status() ;
    my $children = $job->find_children() ;
    while (my $child = $children->next_child()) {
        :
    }

CLASS METHODS ^

new()

    my $hdl = CA::AutoSys->new( [OPT] ) ;

Creates a new CA::AutoSys object.

Below is a list of valid options:

dsn

Specify the DSN of the AutoSys' database server to connect to. If nothing is specified, Sybase will be assumed: dbi:Sybase:server=<your_server> With this option you should be able to connect to databases other than Sybase.

server

This option is deprecated - rather use the dsn option. Specify the AutoSys' database server to connect to. Either this option or the dsn option above must be given. Please note, that when specifying this server option, a Sybase database backend is assumed.

user

Specify the database user. With an out-of-the-box AutoSys installation, the default user should work.

password

Specify the database password. With an out-of-the-box AutoSys installation, the default password should work.

Example:

    my $hdl = CA::AutoSys->new(server => "AUTOSYS_DEV");

INSTANCE METHODS ^

find_jobs()

    my $jobs = $hdl->find_jobs($jobname) ;

Finds jobs with a given name. When you have the wildcard character '%' somewhere in the job name, it will return all matching jobs, i.e.:

To find all jobs starting with the string 'MY_JOB':

    $jobs = $hdl->find_jobs('MY_JOB%');

To find all jobs that have the string 'JOB' somewhere in the name:

    $jobs = $hdl->find_jobs('%JOB%');

To find a job with an exact name:

    $jobs = $hdl->find_jobs('JOB_42');

See also CA::AutoSys::Job

send_event()

    my $rc = $hdl->send_event( [OPT] ) ;

Sends an event to the given job. Returns 1 on success, 0 otherwise. At least the event name should be given. Depending on the event, more options may be necessary (see below). For details, consult your AutoSys' User Guide.

Below is a list of valid options:

job_name

The name of the job - no wildcards allowed.

event

Event name. The following list contains all available event names in alphabetical order:

    ALARM                  CHANGE_PRIORITY        CHANGE_STATUS
    CHECK_HEARTBEAT        CHK_BOX_TERM           CHK_MAX_ALARM
    CHK_N_START            CHK_RUN_WINDOW         COMMENT
    DELETEJOB              EXTERNAL_DEPENDENCY    FORCE_STARTJOB
    HEARTBEAT              JOB_OFF_HOLD           JOB_OFF_ICE
    JOB_ON_HOLD            JOB_ON_ICE             KILLJOB
    QUE_RECOVERY           REFRESH_BROKER         RESEND_EXTERNAL_STATUS
    SEND_SIGNAL            SET_GLOBAL             STARTJOB
status

The job status when the event is CHANGE_STATUS. The following list contains all possible states for the CHANGE_STATUS event in alphabetical order:

    ACTIVATED              FAILURE                INACTIVE
    ON_HOLD                ON_ICE                 QUE_WAIT
    REFRESH_DEPENDENCIES   REFRESH_FILEWATCHER    RESTART
    RUNNING                STARTING               SUCCESS
    TERMINATED
event_time

Use this when you want to schedule an event at a given time. The argument should have the format 'YYYY/MM/DD HH:MM:SS'.

To force a job start at a given time:

    my $rc = $hdl->send_event(job_name => 'HAPPY_NEW_YEAR', event => 'FORCE_STARTJOB',
                              event_time => '2007/12/31 23:59:59');

To mark an job as inactive:

    my $rc = $hdl->send_event(job_name => 'JOB_42', event => 'CHANGE_STATUS', status => 'INACTIVE');

TODOs ^

Make the interface more "perlish", e.g. return an array of jobs instead of forcing the user to call next_job() / next_child().

Make the interface more "OO", e.g. allow the user to send an event directly from an CA::AutoSys::Job object to the underlying job instead of having to use CA::AutoSys->send_event().

There are lots of missing AutoSys features, e.g. "alarms".

SEE ALSO ^

CA::AutoSys::Job, CA::AutoSys::Status

AUTHOR ^

Sinisa Susnjar <sini@cpan.org>

MODIFICATION HISTORY ^

See the CHANGES file.

COPYRIGHT AND LICENSE ^

Copyright (c) 2007 Sinisa Susnjar. All rights reserved.

This program is free software; you can use and redistribute it under the terms of the L-GPL. See the LICENSE file for details.

syntax highlighting: