CA-AutoSys
view release on metacpan or search on metacpan
examples/web/README view on Meta::CPAN
1617181920212223242526272829303132333435# 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.
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
345678910111213141516171819202122#
# $Id: httpd.pl 45 2007-06-21 11:01:37Z sini $
#
use
strict;
use
warnings;
use
Net::HTTPServer;
use
Getopt::Long;
use
CA::AutoSys;
use
HTML::Macro;
use
Pod::Usage;
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
666768697071727374757677787980818283848586
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 )