CA-AutoSys

 view release on metacpan or  search on metacpan

examples/web/README  view on Meta::CPAN

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
 
This directory contains a little sample web server that can be used as a basis
for more elaborate ways to control your AutoSys jobs.
 
The web server makes extensive use of the excellent Perl modules HTML::Macro
and Net::HTTPServer. Those two modules are not mentioned in the dependency list
of CA::AutoSys for obvious reasons. Make sure you have them installed - otherwise
this example web server won't come up...
 
After starting the web server with the following command:
 
  ./httpd.pl --job=YOUR_JOB_PREFIX% --dsn=dbi:Sybase:server=YOUR_AUTOSYS_SERVER
 
you should see something like the following in your console window:

examples/web/httpd.pl  view on Meta::CPAN

3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#
# $Id: httpd.pl 45 2007-06-21 11:01:37Z sini $
#
 
use strict;
 
 
my $port        = 8081;
my $docroot     = $ENV{PWD};
 
my $user        = "autosys";
my $passwd      = "autosys";
my $dsn;
my $job;

examples/web/httpd.pl  view on Meta::CPAN

66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
                        printf("changing status of %s to %s...", $name, $1);
                        $rc = $autosys->send_event(job_name => $name, event => 'CHANGE_STATUS', status => $1);
                } else {
                        printf("sending event %s to %s...", $req->Env($var), $name);
                        $rc = $autosys->send_event(job_name => $name, event => $req->Env($var));
                }
                printf("%s\n", $rc == 1 ? "done" : "failed");
        }
}
 
my $html = new HTML::Macro("$docroot/autosys.html");
 
my $jobs_loop = $html->new_loop("jobs", "id", "background", "job_name1", "job_name2", "last_start", "last_end", "status", "select_class");
 
$jobid = 1;
my $jobs = $autosys->find_jobs($job);
while (my $job = $jobs->next_job()) {
        print_job_status($jobs_loop, $res, $job, 0);
}
 
$res->Print($html->process());



( run in 0.606 second using v1.01-cache-2.11-cpan-26ccb49234f )