[Unicore] TSI dla sge
Piotr Bała
bala@mat.uni.torun.pl
Mon, 16 May 2005 17:48:40 +0200
--0OAP2g/MAC+5xKAE
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Zalaczam skrypty TSI dla irix-sge.
Mysle ze zmiany dotyczace linux'a beda generalnie niewielkie
(o ile w ogole jakies pomijajac sciezke do perl'a).
Piotr Bala
--
------------------------------------------------------------------------
Dr hab. Piotr Bala
Faculty of Math. and Computer Science e-mail: bala@mat.uni.torun.pl
N. Copernicus University phone: (+48-56)611 34 41
Chopina 12/16, 87-100 Torun, POLAND fax: (+48-56)622 89 79
------------------------------------------------------------------------
--0OAP2g/MAC+5xKAE
Content-Type: application/x-tar-gz
Content-Disposition: attachment; filename="irix_sge_TSI.tgz"
Content-Transfer-Encoding: quoted-printable
irix_sge/=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00000755 =00000000 =
=00000000 =0000000000000 10147705720 012503=00 5=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00ustar=0000root=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00sys=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00000000 =00000000 =00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00irix_sge/BecomeUser.pm=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00000755 =00000000 =00000000 =00000=
00016076 07635345573 015125=00 0=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00ustar=0000root=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00sys=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00000=
000 =00000000 =00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00packag=
e BecomeUser;=0A=0Arequire Exporter;=0A@ISA =3D qw(Exporter);=0A=0A@EXPORT_=
OK =3D qw(become_user restore_id);=0A=0Ause Reporting qw(initial_report fai=
led_report debug_report);=0A=0Ause strict;=0A=0A# This module changes the p=
rocess identity=0A=0ABEGIN {=0A=0A # Do we reset our UID to that of user=
s?=0A=0A if( $> =3D=3D 0 ) {=0A=0A # Do setting if our effective =
UID is root=0A=0A # Remember the incoming effective ids, we restore=
=0A # to these after every action. Both real and effective=0A =
# are set to the original effective so that we look=0A # look like =
a root process even from setuid scripts.=0A=0A # CODE < =3D Real UID, > =
=3D Eff UID, ( =3D Real GID, ) =3D Eff GID=0A=0A $BecomeUser::resting_uid =
=3D $>;=0A $BecomeUser::resting_gid =3D $);=0A=0A # Test for support for =
setre*id, if unavailable=0A # fall back on set*id=0A=0A eval {=0A ($(,$=
)) =3D ($BecomeUser::resting_gid,-1);=0A ($<,$>) =3D ($BecomeUser::restin=
g_uid,-1);=0A };=0A=0A if($@) {=0A # setre*id does not seem to be avail=
able, try set*id=0A $( =3D $BecomeUser::resting_gid;=0A $< =3D $BecomeU=
ser::resting_uid;=0A initial_report("Using set*id.");=0A $BecomeUser::g=
ot_setre =3D 0;=0A }=0A else {=0A initial_report("Using setre*id.");=0A=
$BecomeUser::got_setre =3D 1;=0A }=0A=0A initial_report("Running=
privileged [$< : $(], will execute commands as the Xlogin");=0A=0A =
$BecomeUser::setting_uids =3D 1;=0A }=0A else {=0A initial_rep=
ort("Running unprivileged, will execute all commands as [$< : $(]");=0A =
$BecomeUser::setting_uids =3D 0;=0A }=0A=0A}=0A=0A# Change the proce=
ss' identity (real and effective) to a user's (if process was started=0A# w=
ith sufficient privileges to allow this, does nothing otherwise)=0A#=0A# ar=
g 1 =3D Name of the user=0A# arg 2 =3D Name of the project (group)=0A#=0A# =
Returns 1 if successful, 0 otherwise=0A#=0A# Side effects: modifies the ENV=
array, setting values for USER, LOGNAME and HOME=0A#=0Asub become_user {=
=0A=0A if($BecomeUser::setting_uids) {=0A=0A my $new_name =3D shi=
ft;=0A my $new_group =3D shift;=0A=0A my $new_uid =3D $BecomeUser::=
uids{$new_name};=0A=0A if(!$new_uid) {=0A=0A my ($l_name, $l_passw=
d, $l_uid, $l_gid, $l_quota, $l_comment, $l_gcos, $l_dir, $l_shell);=0A =
# Not seen this user name yet, ask the system for a mapping=0A =
# and put it into our cached copy=0A ($l_name, $l_passwd,=
$l_uid, $l_gid, $l_quota, $l_comment, $l_gcos, $l_dir, $l_shell) =3D getpw=
nam($new_name);=0A=0A if(!$l_uid) {=0A failed_rep=
ort("Attempt to run a task for an unknown user $new_name");=0A =
return 0;=0A }=0A=0A debug_report("New user inform=
ation obtained for $new_name ($l_name $l_uid $l_gid) ");=0A=0A #=
Cache this user=0A $BecomeUser::uids{$new_name} =3D $l_uid;=0A =
$BecomeUser::gids{$new_name} =3D $l_gid;=0A $BecomeUs=
er::homes{$new_name} =3D $l_dir;=0A=0A $new_uid =3D $l_uid;=0A =
}=0A=0A # Do not allow changes to root=0A if($new_uid =
=3D=3D 0) {=0A failed_report("Attempt to run a command as root $=
new_name");=0A return 0;=0A }=0A=0A # Do project(group) =
mapping=0A my $new_gid;=0A if($new_group eq "NONE") {=0A # None selecte=
d by user, set default from password file=0A $new_gid =3D $BecomeUser::gi=
ds{$new_name};=0A }=0A else {=0A # User has selected one, check OK and =
set=0A $new_gid =3D $BecomeUser::groups{$new_group}; # map name to gid=
=0A=0A if(!$new_gid) {=0A # Need a new one?=0A my($g_name, $g_passw=
d, $g_gid, $g_members) =3D getgrnam($new_group);=0A=0A if(!$g_gid) {=0A =
failed_report("Unknown group name requested $new_group for TSI user map=
ping.");=0A return 0;=0A }=0A=0A debug_report("New group informat=
ion obtained for $new_group ($g_name $g_gid)");=0A=0A $BecomeUser::group=
s{$new_group} =3D $g_gid;=0A $BecomeUser::members{$new_group} =3D $g_mem=
bers;=0A=0A $new_gid =3D $g_gid;=0A }=0A=0A if($new_gid !=3D $Become=
User::gids{$new_name}) { # is requested the primary group?=0A # Check t=
hat this user is a member of the requested group=0A my $mem_list =3D $Be=
comeUser::members{$new_group};=0A if($mem_list =3D~ m/$new_name/) {=0A =
}=0A else {=0A failed_report("The user $new_name is not a member o=
f the group $new_group.");=0A return 0;=0A }=0A }=0A=0A }=0A=0A =
# Change identity=0A #=0A # Do this in a pair to try to force a call to s=
etreuid =0A # rather than calls to setruid and seteuid - not supported by =
AIX=0A # The -1s force a single value to be changed, preserving the saved =
UID=0A=0A # CODE < =3D Real UID, > =3D Eff UID, ( =3D Real GID, ) =3D Eff =
GID=0A=0A # Go carefully, do groups while effective is root, then real=0A =
# and last effective (permission to set uids is based on effective)=0A=0A =
if($BecomeUser::got_setre) {=0A ($(,$)) =3D ($new_gid,-1);=0A ($(,$)) =
=3D (-1,"$new_gid $new_gid");=0A ($<,$>) =3D ($new_uid,-1);=0A ($<,$>) =
=3D (-1,$new_uid);=0A }=0A else {=0A $( =3D $new_gid;=0A $) =3D "$new=
_gid $new_gid";=0A $< =3D $new_uid;=0A $> =3D $new_uid;=0A }=0A=0A =
if($< !=3D $new_uid) {=0A failed_report("Could not set TSI i=
dentity (real) to $new_name $new_uid.");=0A return 0;=0A =
}=0A=0A if($> !=3D $new_uid) {=0A failed_report("Could no=
t set TSI identity (effective) to $new_name $new_uid.");=0A retu=
rn 0;=0A }=0A=0A if($( !=3D $new_gid) {=0A failed_=
report("Could not set TSI identity (group real) to $new_group $new_gid.");=
=0A return 0;=0A }=0A=0A if($) !=3D $new_gid) {=0A=
failed_report("Could not set TSI identity (group effective) to =
$new_group $new_gid.");=0A return 0;=0A }=0A=0A=0A debug=
_report("Executing command as $new_name [$< : $(] [$>: $)]");=0A=0A =
# Set some sort of user environment=0A $ENV{USER} =3D $new_name;=0A =
$ENV{LOGNAME} =3D $new_name;=0A $ENV{HOME} =3D $BecomeUser::h=
omes{$new_name};=0A=0A }=0A=0A return 1;=0A=0A}=0A=0A# Change the pro=
cess identity back to the initial (probably root).=0A#=0A# No return=0A#=0A=
# Side effects: modifies the ENV array, setting dummy values for USER, LOGN=
AME and HOME=0A=0Asub restore_id {=0A=0A if($BecomeUser::setting_uids) {=
=0A=0A # Go carefully back to resting effective first -=0A # this g=
oes because of saved? - then real - so that=0A # ps gives resting, then gr=
oups OK coz effective is root=0A=0A if($BecomeUser::got_setre) {=0A ($<,=
$>) =3D (-1,$BecomeUser::resting_uid);=0A ($<,$>) =3D ($BecomeUser::resti=
ng_uid,-1);=0A ($(,$)) =3D (-1,$BecomeUser::resting_gid);=0A ($(,$)) =
=3D ($BecomeUser::resting_gid,-1);=0A }=0A else {=0A $> =3D $BecomeUser=
::resting_uid;=0A $< =3D $BecomeUser::resting_uid;=0A $) =3D $BecomeUse=
r::resting_gid;=0A $( =3D $BecomeUser::resting_gid;=0A }=0A=0A $E=
NV{USER} =3D "nobody";=0A $ENV{LOGNAME} =3D "nobody";=0A $ENV=
{HOME} =3D "/tmp";=0A=0A debug_report("Restored IDs to [$< : $(] [$>=
: $)]");=0A }=0A}=0A=0A#=0A# $Id: BecomeUser.pm,v 1.17 2001/10/01 16:32=
:41 svdb Exp $=0A#=0A# 04-05-01 Sven van den Berghe fecit Created from 3.0 =
TSI for Unicore 3.5=0A#=0A# Copyright 1999 to 2001 Fu=
jitsu European Centre for Information Technology Ltd.=0A# This is unpublis=
hed proprietary source code which is the property of Fujitsu European Centr=
e for Information Technology Ltd.=0A#=0A# 01-10-01 SvdB Clears supplementar=
y group list, tests to see if setre*id is available=0A# 24-07-01 SvdB Now s=
ets the group id too=0A# 02-07-01 SvdB No longer use English (why?), carefu=
l expression of=0A# setuid, setgid to generate setreu(g)id ca=
lls=0ASI for Unicore 3.5=0A#=0A# Copyright 1999 to 20=
01 Fujitsu European Centre for Information Technology Ltd.=0A# This is unp=
ublished proprietary source code which is the property of Fujitsu European =
Centre for Information Technology Ltd.=0A#=0A# 01-10-01 SvdB Clears supplem=
entary group list, tests to see if setre*id is available=0A# 24-07-01 SvdB =
Now sets the group id too=0A# 02-07-01 SvdB No longer use English (why?), c=
areful expression ofirix_sge/Dump2File.pm=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00000755 =00000000 =000=
00000 =0000000002650 07635345573 014654=00 0=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00ustar=0000root=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00sys=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00000000 =00000000 =00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00package Dump2File;=0A=0Arequire Exporter;=0A@ISA =3D qw(Exporter);=0A=
=0A@EXPORT_OK =3D qw(dump2file);=0A=0Ause strict;=0A=0ABEGIN {=0A $Dump2=
File::dumper =3D 1; # Order dump files sequentially=0A}=0A=
=0A# uses values set in the configuration section ($main::dump_messages);=
=0A=0A#=0A# Dump value to file=0A#=0Asub dump2file {=0A if($main::dump_m=
essages) {=0A my $bytes =3D shift;=0A my $len =3D length($byt=
es);=0A my @tima =3D localtime;=0A my $s =3D $tima[0];=0A =
my $m =3D $tima[1];=0A my $h =3D $tima[2];=0A my $D =3D $=
tima[3];=0A my $M =3D $tima[4] + 1;=0A my $Y =3D $tima[5] + 1=
900;=0A my $suffix =3D sprintf("%2d-%2d-%2d_%2d:%2d:%2d_%4d",=0A =
$Y, $M, $D, $h, $m, $s, $Dump2File::dumper);=0A $=
suffix =3D~ s/\s/0/g;=0A # my $dump_file =3D "DUMP.$ENV{USER}.$suffi=
x"; Perl complains that ENV is insecure=0A my $dump_file =3D "TSI_DU=
MP.$suffix";=0A $Dump2File::dumper++;=0A=0A open(DUMP,">$dump=
_file");=0A my $offset =3D 0; # See Programming Perl p231=0A =
while($len) { # Handle partial writes=0A my $written =3D syswri=
te DUMP, $bytes, $len, $offset;=0A if ( ! defined $written )=0A =
{=0A print "DUMP write error ($len bytes) to file=
$dump_file: $!\n";=0A last;=0A } # unless define=
d $written;=0A $len -=3D $written;=0A $offset +=3D $w=
ritten;=0A }=0A close(DUMP);=0A }=0A}=0A#=0A# Code from Kl=
aus-Dieter Oertel (Pallas)=0A_file");=0A my $offset =3D 0; # See Pr=
ogramming Perl p231=0A while($len) { # Hairix_sge/EndProcessing.pm=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
000755 =00000000 =00000000 =0000000010201 07635345573 015617=00 0=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00ustar=000=
0root=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00sys=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00000000 =00000000 =00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00package EndProcessing;=0A=0Arequire Exporter;=0A=
@ISA =3D qw(Exporter);=0A=0A@EXPORT_OK =3D qw(end_processing);=0A=0Ause Rep=
orting qw(start_report ok_report failed_report command_report);=0A=0Ause st=
rict;=0A=0A# Processing at the (possible) end of a BSS job=0A=0A# GENERIC=
=0A=0A#=0A# Called in response to a TSI_ENDPROCESSING request from the NJS=
=0A#=0A# Used to detect if a BSS job has finished executing (NJS thinks=0A#=
that it has because it has disappeared from qstat but this may=0A# not be =
correct - moving between queues and also moves stder/stdout=0A# to the Outc=
ome directory.=0A#=0A# arg1: text sent by the NJS. this is processed for:=
=0A# TSI_BSSID - the identifier of the BSS job which the NJS thin=
ks=0A# has finished=0A# TSI_OUTCOME_DIR=
ECTORY - directory for the stdout and stderr files=0A# =
"NONE" is interpreted as delete the files=0A#=0A# returns: void to TS=
I=0A# if job has completed, then returns the lines from=0A# =
stderr that contains the exit code of the user's job=0A# an=
d, if present, the contents of $UC_DECISION_FILE=0A# if job has no=
t completed returns TSI_STILLEXECUTING=0A#=0A# side effect: moves stdout an=
d stderr of completed job to TSI_OUTCOME_DIRECTORY=0A#=0Asub end_processing=
{=0A=0A my ($junk, $out_name, $err_name);=0A=0A my $from_njs =3D shi=
ft;=0A=0A my $requestid;=0A my $outcome_directory;=0A my $disposition=
=3D "KEEP";=0A=0A command_report("Testing for end of job.");=0A=0A $_ =
=3D $from_njs;=0A =0A while(/#TSI_(\S+) (.*)\n/g) {=0A $requestid =
=3D $2 if $1 eq "BSSID";=0A $outcome_directory =3D $2 if $1 eq "OUTCOME_DI=
R";=0A $disposition =3D $2 if $1 eq "DISPOSITION";=0A }=0A=0A $ou=
tcome_directory =3D~ s/\$USER/$ENV{USER}/g;=0A $outcome_directory =3D~ s=
/\$HOME/$ENV{HOME}/g;=0A=0A start_report("End detecting for: $requestid =
(stdout and stderr in $outcome_directory)");=0A=0A # Perl is over parano=
id, at this point we are always=0A # set to a user, so this is safe. Unt=
aint the data.=0A if( $outcome_directory =3D~ /(.+)/ ) {=0A $outc=
ome_directory =3D $1;=0A }=0A=0A # The BSS was requested to put stdout a=
nd stderr in these files (see Submit.pm)=0A $out_name =3D "$outcome_directo=
ry/stdout";=0A $err_name =3D "$outcome_directory/stderr";=0A=0A # Are th=
e files there? They may not be as the NJS=0A # could be wrong in thinkin=
g that the job is done.=0A #=0A # Assume here that the BSS always ret=
urns _both_ stdout and stderr=0A # files to here, if only one is returne=
d the NJS will never think=0A # that the job has finished. Note that the=
NJS insert commands to=0A # ensure that something is _always_ written t=
o both stdout and stderr.=0A=0A if(! -e $out_name) {=0A failed_repor=
t("TSI_STILLEXECUTING. stdout file not found\n");=0A return;=0A }=
=0A=0A if(! -e $err_name) {=0A failed_report("TSI_STILLEXECUTING. st=
derr file not found\n");=0A return;=0A }=0A=0A # Got the files=
, extract the result code for the NJS=0A # (if any) is the line with UNI=
CORE EXIT STATUS=0A=0A my $results =3D "Line not found\n";=0A=0A if( =
! open(FILE, "<$err_name") ) {=0A # File open failed, NJS expects it=
to be there. So=0A # another process could have deleted it (end of =
that Job?)=0A failed_report("stderr file not found(2)");=0A r=
eturn;=0A }=0A=0A $/ =3D "\n"; # go back to standard for a while (mai=
n loop restores to usual marker)=0A=0A while(<FILE>) {=0A $result=
s =3D $results.$_ if /UNICORE EXIT STATUS/;=0A $results =3D $results=
.$_ if /UNICORE DECISION/; # V4 return DECISON too=0A }=0A=0A=
close(FILE);=0A=0A # and dispose of the files (move or delete)=0A =
if($disposition eq "DELETE") {=0A unlink $out_name;=0A unlin=
k $err_name;=0A }=0A=0A ok_report($results);=0A print main::CMD_SO=
CK $results;=0A=0A}=0A=0A#=0A# $Id: EndProcessing.pm,v 1.14 2001/09/12 11:0=
1:19 svdb Exp $=0A#=0A# 13-08-02 Sven van den Berghe FLE Added fetch of Dec=
ision, removed some commented-out code=0A# 04-05-01 Sven van den Berghe fec=
it Created from 3.0 TSI for Unicore 3.5=0A#=0A# Copyr=
ight 1999 to 2001 Fujitsu European Centre for Information Technology Ltd.=
=0A# This is unpublished proprietary source code which is the property of =
Fujitsu European Centre for Information Technology Ltd.=0A# 24-07-01 SvdB s=
tdout and stderr are placed in outcome directory by BSS=0Av 1.14 2001/09/12=
11:01:19 svdb Exp $=0A#=0A# 13-08-02 Sven van den Berghe FLE Added fetch o=
f Decision, removed some commented-out code=0A# 04-05-01 Sven van den Bergh=
e fecit Created from 3.0 TSI for Unicore 3.5=0A#=0A# =
Copyright 1999 to 2001 Fujitsu European Centre for Information Technology L=
td.=0A# This is unpublished proprietary source code which is the property =
of irix_sge/ExecuteScript.pm=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00000755 =00000000 =00000000 =0000000002663 076=
35345573 015660=00 0=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00ustar=0000root=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00sys=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00000000 =0000000=
0 =00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00package ExecuteScr=
ipt;=0A=0Arequire Exporter;=0A@ISA =3D qw(Exporter);=0A=0A@EXPORT_OK =3D qw=
(execute_script);=0A=0Ause Reporting qw(start_report failed_report ok_repor=
t);=0A=0Ause strict;=0A=0A# Executes a script from the NJS "interactively"=
=0A#=0A# Called in response to a #TSI_EXECUTESCRIPT string found in the =0A=
# NJS message.=0A=0A=0A# arg 1 =3D Script to execute=0A#=0A# Returns void t=
o TSI=0A#=0A# success/failure to NJS=0A#=0Asub execute_script {=0A =0A =
my $script =3D shift;=0A=0A # Substitute for these values as the execu=
ted script's=0A # environment will not (and if it did the values will=
=0A # be wrong). This is safe as thes script seen here is=0A # comp=
letely generated by the NJS and so we will not be =0A # messing with an=
y user created code.=0A=0A $script =3D~ s/\$USER/$ENV{USER}/g;=0A $=
script =3D~ s/\$HOME/$ENV{HOME}/g;=0A=0A start_report("Executing a scri=
pt.");=0A =0A my $output =3D `($script) 2>&1`;=0A =0A if($? !=3D 0)=
{=0A failed_report($output);=0A }=0A else {=0A ok_re=
port($output);=0A print main::CMD_SOCK $output;=0A }=0A }=0A#=0A=
# $Id: ExecuteScript.pm,v 1.15 2001/08/28 16:55:50 svdb Exp $=0A#=0A# 04-05=
-01 Sven van den Berghe fecit Created from 3.0 TSI for Unicore 3.5=0A# 04-0=
6-01 Sven van den Berghe fecit Replace $USER and $HOME=0A#=0A# =
Copyright 1999 to 2001 Fujitsu European Centre for Information Te=
chnology Ltd.=0A# This is unpublished proprietary source code which is the=
property of Fujitsu European Centre for Information Technology Ltd.=0A=0A=
=0A ok_report($output);=0A print main::CMD_SOCK $output;=0A =
}=0A }=0Airix_sge/GetFileChunk.pm=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00000644 =00000000 =00000000 =00000000=
05117 10147705720 015355=00 0=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00ustar=0000root=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00sys=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00000000=
=00000000 =00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00package G=
etFileChunk;=0A=0Arequire Exporter;=0A@ISA =3D qw(Exporter);=0A=0A@EXPORT_O=
K =3D qw(get_file_chunk);=0A=0Ause Reporting qw(start_report failed_report =
ok_report debug_report report_and_die);=0A=0Ause strict;=0A=0A# Writes to t=
he NJS COMMAND and DATA sockets=0A=0A# Return part of a file to the NJS=0A#=
=0A# Called in response to a TSI_GETFILECHUNK request from the NJS=0A#=0A# =
arg1: text sent by the NJS. this is processed for:=0A# TSI_FILE =
- file to return=0A# TSI_START - start byte=0A# TSI_L=
ENGTH - how many bytes to return=0A#=0A# returns: void to TSI=0A#=0A# =
takes over NJS-TSI protocol to send files.=0A#=0A#=0Asub get_file_chunk=
{=0A=0A my $from_njs =3D shift;=0A=0A my $file;=0A my $start;=0A my =
$length;=0A=0A ($file) =3D ($from_njs =3D~ /.*#TSI_FILE (.+)\n/);=0A=
($start) =3D ($from_njs =3D~ /.*#TSI_START (.+)\n/);=0A ($length) =3D=
($from_njs =3D~ /.*#TSI_LENGTH (.+)\n/);=0A=0A $file =3D~ s/\$USER/$ENV=
{USER}/g;=0A $file =3D~ s/\$HOME/$ENV{HOME}/g;=0A=0A debug_report("Re=
turning expanded file name: $file\n");=0A=0A if( ! open(FILE, "<$file") =
) {=0A failed_report("File cannot be opened: $file");=0A retu=
rn;=0A }=0A=0A if( -p $file) {=0A # This is a fifo, don't skip initial =
bytes (ignore start)=0A debug_report("Reading a fifo: $file $length\n");=
=0A }=0A else {=0A debug_report("Reading a file: $file $start $length\n");=
=0A if( ! sysseek(FILE, $start, 0) ) {=0A failed_report("Cannot skip to =
$start in $file");=0A close(FILE);=0A return;=0A }=0A }=0A=0A my $buf;=
=0A my $offset =3D0;=0A my $message =3D "TSI_OK";=0A=0A # Read in the reque=
sted number of bytes=0A while($length > 0) {=0A my $read =3D sysread FILE,=
$buf, $length, $offset;=0A if(!defined $read) {=0A $message =3D "TSI_FA=
ILED: Problems reading file";=0A last;=0A }=0A if($read =3D=3D 0) {=0A =
if( -p $file) {=0A $message =3D "TSI_OK: FIFO EOF";=0A }=0A else {=
=0A $message =3D "TSI_FAILED: Unexpectedly at end of file (got $offset, =
still need $length) $file $start";=0A }=0A last;=0A }=0A=0A $length =
=3D $length - $read;=0A $offset =3D $offset + $read;=0A }=0A close(FILE);=
=0A print main::CMD_SOCK "$message\nTSI_LENGTH $offset\n";=0A print main::C=
MD_SOCK "ENDOFMESSAGE\n";=0A=0A my $woffset =3D 0;=0A =0A my $written;=0A w=
hile($offset) { # handling partial writes=0A $written =3D syswrite main::=
DATA_SOCK, $buf, $offset, $woffset;=0A report_and_die("Portfolio copy erro=
r writing to NJS: $!") unless defined $written;=0A $offset -=3D $written;=
=0A $woffset +=3D $written;=0A };=0A=0A}=0A#=0A# Copyrig=
ht (c) Fujitsu Ltd 2000 - 2004=0A#=0A# Use and distribution =
is subject a License.=0A# A copy was supplied with the distribution (see do=
cumentation or the jar file).=0A#=0A# This product includes software develo=
ped by Fujitsu Limited (http://www.fujitsu.com).=0A partial writes=0A $wri=
tten =3D syswrite main::DATA_SOCK, $buf, $offset, $woffset;=0A report_and_=
die("Portfolio copy error writing to NJS: $!") unless defined $written;=0A =
$offset -=3D $written;=0A $woffset +=3D $written;=0A };=0A=0A}=0A#=0A# =
Copyright (c) Fujitsu Ltd 2000 - 2004=0A#=0A# =
Use and distribution is subject a License.=0A# A copy was supplied with t=
he distribution (see documentation or the jar file).=0A#=0A# This pririx_sg=
e/GetStatusListing.pm=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00000755 =00000000 =00000000 =0000000010554 07635347021 016332=00=
0=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00ustar=0000root=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00sys=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00000000 =00000000 =00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00package GetStatusListing; =0A=0A####=
###########################################################################=
=0A# Irix 6.5 with Sun GridEngine5.3 installed=0A##########################=
#####################################################=0A=0Arequire Exporter=
;=0A@ISA =3D qw(Exporter);=0A=0A@EXPORT_OK =3D qw(get_status_listing);=0A=
=0Ause Reporting qw(debug_report failed_report ok_report start_report comma=
nd_report report_and_die);=0A=0Ause strict;=0A=0A# Queries the BSS for the =
state of (at least) all Unicore jobs=0A# and returns a list of their identi=
fier together with the=0A# stats.=0A#=0A# Called in response to a #TSI_JOBQ=
UERY in the script=0A=0A# uses functions from Reporting=0A=0A# No args=0A#=
=0A# Returns void to TSI=0A# fail/success to NJS and a list of jobs=
=0A#=0A# First line is "QSTAT",=0A# followed by a line per fo=
und job, first word is BSS job identifier=0A# and the second word is=
one of RUNNING, QUEUED or SUSPENDED=0A#=0A# List must include all U=
nicore jobs (but can contain extra jobs)=0A#=0Asub get_status_listing {=0A=
=0A my($command, $output, $result, $bssid, $state, $ustate, $result);=0A=
=0A start_report("Finding all jobs on BSS");=0A=0A # Form the request=
command. =0A $command =3D "$main::qstat_cmd";=0A=0A command_report($=
command);=0A=0A $output =3D `($command) 2>&1`;=0A=0A # Parse output=
=0A if($? !=3D 0) {=0A failed_report($output);=0A }=0A else=
{=0A # Command succeeded. Parse the output and return=0A # a=
line for each job found with two words, the first=0A # is the job i=
d the second its _Unicore_ state.=0A=0A # The output format of the c=
orresponding qstat (qstat -s prs) command is:=0A #=0A # job-I=
D prior name user state submit/start at queue maste=
r ja-task-ID =0A # ------------------------------------------------=
---------------------------------------------=0A # 3 0 tes=
t mirnaz t 03/16/2003 17:20:11 monsun.q MASTER =
=0A # xxxxxxx junk junk junk xxxxx junk ... =0A=
#=0A # Where fields marked as xxxxx (jobid and status) are t=
he only important to us.=0A #=0A # The header lines are unint=
eresting, we skip them=0A # Ignore the minor states=0A=0A $re=
sult =3D "QSTAT\n";=0A=0A $_ =3D $output;=0A #=0A # Te=
rms are: start of a line=0A # digit (integer) <- put into=
$1=0A # "." marks end of integer=0A # =
any amount of junk=0A # " " marks start of last word on a=
line=0A # Character <- put into $2=0A # =
(possibly) more characters in the word=0A # (poss=
ibly) space=0A # ties match to one line=0A #=0A =
# Note g to resume from end of last match=0A # while(/^(\d+)\..=
* (\S)\S*\s*$/gm) {=0A while(/^\s*(\d+)\s+\d+\s+\w+\s+\w+\s+(\w+)\s+=
.*$/gm) {=0A=0A $bssid =3D $1;=0A $state =3D $2;=0A=
=0A debug_report(" Job id=3D$bssid, status=3D$state");=0A=0A =
# Catches all known values.=0A # Absent statuses are tre=
ated as unknown as status will contain a number=0A $ustate =3D "=
UNKNOWN";=0A=0A # w - waiting=0A # h - hold=0A =
$ustate =3D "QUEUED" if $state =3D~ /w|h/;=0A=0A # t - tra=
nsfering=0A # r - running=0A $ustate =3D "RUNNING" if=
$state =3D~ /r|t/ ;=0A=0A # s - suspended (job suspended by qmo=
d)=0A # S - suspended (job suspended because queue was suspended=
)=0A # T - Threshold (at least one suspend threshold of the corr=
esponding queue was exceeded)=0A # R - Restarted (job was rest=
arted , maybe RUNNING would be a better hit?)=0A # d - deleted=
=0A $ustate =3D "SUSPENDED" if $state =3D~ /s|S|T|R|d/ ;=0A=0A =
# U - unknown=0A=0A # Add to the returned lines=0A =
$result =3D "$result $bssid $ustate\n";=0A=0A }=0A=0A =
print main::CMD_SOCK $result;=0A debug_report("qstat executed OK");=
=0A }=0A=0A}=0A#=0A# $Id: GetStatusListing.pm,v 1.13 2001/08/28 16:55:59=
svdb Exp $=0A#=0A# 15.03.2003, ported to Irix with SGE5.3 by M. Nazaruk (m=
irnaz@icm.edu.pl)=0A# based on a version for UNICOS=0A#=0A# 04-=
05-01 Sven van den Berghe fecit Created from 3.0 TSI for Unicore 3.5=0A#=0A=
# Copyright 1999 to 2001 Fujitsu European Centre for =
Information Technology Ltd.=0A# This is unpublished proprietary source cod=
e which is the property of Fujitsu European Centre for Information Technolo=
gy Ltd.=0A#=0A");=0A }=0A=0A}=0A#=0A# $Id: GetStatusListing.pm,v 1.13 20=
01/08/28 16:55:59 svdb Exp $=0A#=0A# 15.03.2003, ported to Irix with SGE5.3=
by M. Nazaruk (mirnaz@icmirix_sge/Initialisation.pm=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00000755 =00000000 =000000=
00 =0000000015136 10150143721 016021=00 0=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00ustar=0000root=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00sys=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00000000 =00000000 =00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00package Initialisation;=0A=0A# V4 Inserted 5 lines to die on command fro=
m NJS =0A=0Arequire Exporter;=0A@ISA =3D qw(Exporter);=0A=0A@EXPORT_OK =3D =
qw(initialisation);=0A=0Ause Socket; =0Ause Reporting qw(initial_rep=
ort report_and_die);=0A=0Ause strict;=0A=0Asub GENTLY {=0A initial_report("=
TSI Shepherd requested to finish (SIGTERM)");=0A close(FROM_NJS);=0A exit(0=
);=0A}=0A=0A=0Asub initialisation() {=0A=0A $SIG{CHLD} =3D 'IGNORE';=0A $SI=
G{TERM} =3D \&GENTLY;=0A=0A initial_report("TSI $main::my_version for $m=
ain::my_os ");=0A initial_report("Copyright (c) Fujitsu Ltd, 1999 to 200=
1. All Rights Reserved.\n");=0A initial_report("Using Perl version $]");=
=0A=0A # ---------------------------------------------------------------=
-----=0A # Where to contact the NJS. This information can come=0A # f=
rom the command line (two arguments in order host_name, port)=0A # or, f=
ailing that, from values in the initialisation section.=0A #=0A # The=
NJS is told about TSIs in the IDB TSI description section=0A # with the=
keyword PORT.=0A=0A my $njs_machine =3D $main::njs_machine;=0A if ($njs=
_machine =3D~ m/(.*)/s ) {=0A $njs_machine =3D $1;=0A }=0A=0A my $njs_p=
ort =3D $main::njs_port;=0A if ($njs_port =3D~ m/(.*)/s ) {=0A $njs_por=
t =3D $1;=0A }=0A=0A my $my_port =3D $main::my_port;=0A if ($my_port =
=3D~ m/(.*)/s ) {=0A $my_port =3D $1;=0A }=0A=0A my $proto =3D getproto=
byname('tcp');=0A=0A if($njs_port =3D~ /\D/) {$njs_port =3D getservbynam=
e($njs_port, 'tcp')};=0A die "No NJS port\n" unless $njs_port;=0A=0A =
my $iaddr =3D inet_aton($njs_machine);=0A my $ip_address =3D inet_ntoa($iad=
dr);=0A my $paddr =3D sockaddr_in($njs_port, $iaddr);=0A=0A my $old_f=
h =3D select(STDOUT);=0A $| =3D 1;=0A select($old_fh);=0A=0A $old_=
fh =3D select(STDERR);=0A $| =3D 1;=0A select($old_fh);=0A=0A # Open =
a server socket to listen for new TSI requests from the NJS=0A socket(FROM_=
NJS, PF_INET, SOCK_STREAM, $proto);=0A setsockopt(FROM_NJS, SOL_SOCKET, SO_=
REUSEADDR, 1);=0A my $from_njs_addr =3D sockaddr_in($my_port, INADDR_ANY);=
=0A bind(FROM_NJS, $from_njs_addr) or die "Could not bind to port $my_port:=
$!\n";=0A listen(FROM_NJS, SOMAXCONN) or die "Could not listen on port =
$my_port: $!\n";=0A=0A my ($other_end, $other_iaddr, $other_port, $pid);=
=0A while(accept(NJS_CLIENT, FROM_NJS)) {=0A=0A # Got connection, from NJS=
?=0A=0A if($other_end =3D getpeername(NJS_CLIENT)) {=0A=0A ($other_port,=
$other_iaddr) =3D unpack_sockaddr_in($other_end);=0A my $other_ip_addres=
s =3D inet_ntoa($other_iaddr);=0A=0A if($other_ip_address eq $ip_address)=
{=0A=0A # V4 Read message from NJS to see if we need to go=0A my $me=
ssage =3D <NJS_CLIENT>;=0A $message =3D~ /get down shep\n/ && do {=0A =
initial_report("NJS requested a stop");=0A GENTLY();=0A };=0A=
# V4 END =0A=0A # Write anything to tell NJS that this is OK=0A $=
old_fh =3D select(NJS_CLIENT);=0A $| =3D 1;=0A select($old_fh);=0A =
print NJS_CLIENT "OK\n"; =0A close(NJS_CLIENT);=0A=0A # ------------=
--------------------------------------------------------=0A # Open a pai=
r of sockets to the NJS, one to carry commands (text)=0A # and the other=
to carry data (files read and written).=0A =0A initial_report("Cont=
acting the NJS on <$njs_machine> at port number <$njs_port>");=0A=0A # O=
pen the commands channel, wait here for the NJS to start listening=0A so=
cket(main::CMD_SOCK, PF_INET, SOCK_STREAM, $proto) or report_and_die("comma=
nd socket: $!");=0A while(! connect(main::CMD_SOCK, $paddr) ) {=0A i=
nitial_report("Waiting for NJS at $njs_machine:$njs_port to come up (last c=
onnect attempt said: $!)");=0A sleep 3;=0A socket(main::CMD_SOCK, P=
F_INET, SOCK_STREAM, $proto) or report_and_die("command socket: $!");=0A =
}=0A=0A # Open the data channel=0A socket(main::DATA_SOCK, PF_INET, =
SOCK_STREAM, $proto) or report_and_die("data socket: $!");=0A connect(ma=
in::DATA_SOCK, $paddr) or report_and_die("data connect=
: $!");=0A=0A # Ensure that output is flushed=0A $old_fh =3D select(m=
ain::CMD_SOCK);=0A $| =3D 1;=0A select($old_fh);=0A=0A $old_fh =3D=
select(main::DATA_SOCK);=0A $| =3D 1;=0A select($old_fh);=0A=0A i=
nitial_report("Connection to NJS established.");=0A=0A # ---------------=
-----------------------------------------------------=0A # Now fork the =
child which becomes the requested TSI=0A if( $pid =3D fork ) {=0A # =
Parent, do not want the NJS sockets=0A close(main::CMD_SOCK);=0A cl=
ose(main::DATA_SOCK);=0A next; # go back to accept=0A=0A }=0A el=
sif(defined $pid) { # $pid is actually 0 in child=0A # Child, do not w=
ant the listener to NJS connections=0A close(FROM_NJS);=0A=0A # Cle=
ar the signal handlers, CHLD screws script execution=0A $SIG{CHLD} =3D =
'DEFAULT';=0A $SIG{TERM} =3D 'DEFAULT';=0A=0A # Gnat=
s ID 104=0A #=0A # Reset some variabl=
es that must be unique amongst all TSIs=0A # Do it here =
so that sites don't have to redo changes made to Submit.pm=0A =
# =0A # the "eval" should trap errors in TSI=
s that do not use the =0A # particular variable=0A =
# =0A eval { =0A =
$Submit::counter=3D$$*100 # For Solaris versions=0A =
}; =0A eval { =0A $Submit:=
:tsi_unique_file_name=3D"TSI_temp_file_$$" # for all other TSIs=0A =
}; =0A=0A return; # <---- Back to tsi and so to the ma=
in processing loop=0A }=0A else {=0A # Fork failed, NJS will even=
tually notice that worker will=0A # not contact and retry so as for par=
ent=0A close(main::CMD_SOCK);=0A close(main::DATA_SOCK);=0A nex=
t;=0A }=0A }=0A else {=0A # IP addresses differ, ignore=0A clo=
se(NJS_CLIENT);=0A initial_report("The other end of a start TSI request =
does not come from the NJS, ignoring: $other_ip_address");=0A }=0A }=0A =
else {=0A close(NJS_CLIENT);=0A initial_report("Could not identify oth=
er end of a start TSI request, ignoring.");=0A }=0A }=0A=0A # Should never=
never get here ......=0A die "Failed while listening for NJS connections: =
$!\n";=0A=0A}=0A=0A#=0A# $Id: Initialisation.pm,v 1.21 2002/03/21 11:38:59 =
svdb Exp $=0A#=0A# 13-08-02 Sven van den Berghe FLE Now quits on command fr=
om NJS ("get down shep")=0A# 21-03-02 Sven van den Berghe fecit Proper hand=
ling after fork, =0A# Gnats 104: properl=
y unique Submit file names=0A# 07-12-01 Sven van den Berghe fecit Now acts =
as the TSI Shepherd, returning only to main loop as a child=0A# 04-05-01 Sv=
en van den Berghe fecit Created from 3.0 TSI for Unicore 3.5=0A#=0A# =
Copyright (c) Fujitsu Ltd 2000 - 2002=0A#=0A# Use and distribution is s=
ubject to the Community Source Licence.=0A# =
=0A# A copy of the Community Source Licence came wit=
h this distribution.=0A# Copies are also available at http://www.fecit.co.u=
k/arcon or by =0A# email from arcon@fecit.co.uk. =0Avan den Berghe fecit No=
w acts as the TSI Shepherd, returning only to main loop as a child=0A# 04-0=
5-01 Sven van den Berghe fecit Created from 3.0 TSI for Unicore 3.5=0A#=0A#=
Copyright (c) Fujitsu Ltd 2000 - 2002=0A#=0A# Use and distributi=
on is subject to the Community Source Licence.=0A# =
=0A# A copy of the Community Source Licence c=
ame with this distribution.=0A# Copiirix_sge/JobControl.pm=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00000755=
=00000000 =00000000 =0000000006643 07635345573 015146=00 0=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00ustar=0000root=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00sys=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00000000 =00000000 =00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00package JobControl;=0A=0Arequire Exporter;=0A@ISA =3D =
qw(Exporter);=0A=0A@EXPORT_OK =3D qw(abort_job cancel_job hold_job resume_j=
ob);=0A=0Ause Reporting qw(start_report failed_report ok_report command_rep=
ort);=0A=0Ause strict;=0A=0A# Generic BSS job control functions=0A=0A#=0A# =
Assumes that the following variables have been set up =0A# before a call:=
=0A#=0A# $main::site_sez_no_holds: true if jobs on BSS cannot be held=0A#=
=0A# $main::abort_cmd: command to execute to abort a BSS job (with process=
id asa argument)=0A# $main::cancel_cmd: command to execute to cancel a BS=
S job (with process id asa argument)=0A# $main::hold_cmd: command to execu=
te to hold a BSS job (with process id asa argument)=0A# $main::resume_cmd: =
command to execute to resume a BSS job (with process id asa argument)=0A=
=0A=0A# Abort a job on the BSS.=0A#=0A# arg1: text from NJS with TSI_BSSID =
<request id>=0A#=0Asub abort_job {=0A=0A my $from_njs =3D shift;=0A=0A =
my ($requestid, $output, $command);=0A=0A ($requestid) =3D ($from_njs =
=3D~ /.*#TSI_BSSID (.+)\n/);=0A=0A start_report("Aborting request $reque=
stid");=0A=0A $command =3D "$main::abort_cmd $requestid\n";=0A=0A com=
mand_report($command);=0A=0A $output =3D `($command) 2>&1`;=0A=0A # P=
arse output=0A if($? !=3D 0) {=0A failed_report($output);=0A }=
=0A else {=0A ok_report($output);=0A }=0A}=0A=0A=0A=0A# Cancel=
a job on the BSS (abort plus dispose of output files)=0A#=0A# arg1: text f=
rom NJS with TSI_BSSID <request id>=0A#=0Asub cancel_job {=0A=0A my $fro=
m_njs =3D shift;=0A=0A my ($requestid, $output, $command);=0A=0A ($re=
questid) =3D ($from_njs =3D~ /.*#TSI_BSSID (.+)\n/);=0A=0A start_report(=
"Cancelling request $requestid");=0A=0A $command =3D "$main::cancel_cmd =
$requestid\n";=0A=0A command_report($command);=0A=0A $output =3D `($c=
ommand) 2>&1`;=0A=0A # Parse output=0A if($? !=3D 0) {=0A fail=
ed_report($output);=0A }=0A else {=0A ok_report($output);=0A =
}=0A}=0A=0A=0A# Hold a job on the BSS.=0A#=0A# arg1: text from NJS with T=
SI_BSSID <request id>=0A#=0Asub hold_job {=0A=0A if($main::site_sez_no_h=
olds) {=0A ok_report("No holding of jobs on BSS")=0A }=0A else=
{=0A=0A my $from_njs =3D shift;=0A=0A my ($requestid, $outpu=
t, $command);=0A=0A ($requestid) =3D ($from_njs =3D~ /.*#TSI_BSSID (=
.+)\n/);=0A=0A start_report("Holding request $requestid");=0A=0A =
$command =3D "$main::hold_cmd $requestid\n";=0A =0A command_repo=
rt($command);=0A =0A $output =3D `($command) 2>&1`;=0A =0A if=
($? !=3D 0) {=0A failed_report($output);=0A }=0A e=
lse {=0A ok_report($output);=0A }=0A }=0A=0A}=0A=0A# R=
esume a job on the BSS.=0A#=0A# arg1: text from NJS with TSI_BSSID <request=
id>=0A#=0Asub resume_job {=0A=0A if($main::site_sez_no_holds) {=0A =
ok_report("No holding of jobs on BSS")=0A }=0A else {=0A=0A =
my $from_njs =3D shift;=0A=0A my ($requestid, $output, $command);=
=0A=0A ($requestid) =3D ($from_njs =3D~ /.*#TSI_BSSID (.+)\n/);=0A=
=0A start_report("Resuming request $requestid");=0A=0A $comma=
nd =3D "$main::resume_cmd $requestid\n";=0A =0A command_report($comm=
and);=0A =0A $output =3D `($command) 2>&1`;=0A =0A if($? =
!=3D 0) {=0A failed_report($output);=0A }=0A else =
{=0A ok_report($output);=0A }=0A }=0A}=0A# $Id: JobCon=
trol.pm,v 1.13 2001/08/28 16:55:51 svdb Exp $=0A#=0A# 04-05-01 Sven van den=
Berghe fecit Created from 3.0 TSI for Unicore 3.5=0A#=0A# =
Copyright 1999 to 2001 Fujitsu European Centre for Information Techno=
logy Ltd.=0A# This is unpublished proprietary source code which is the pro=
perty of Fujitsu European Centre for Information Technology Ltd.=0A#=0A2>&1=
`;=0A =0A if($? !=3D 0) {=0A failed_report($output);=0A =
}=0A else {=0A irix_sge/MainLoop.pm=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00000755 =0000=
0000 =00000000 =0000000012061 10147705720 014562=00 0=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00ustar=0000root=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00sys=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00000000 =00000000 =00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00package MainLoop;=0A=0Arequire Exporter;=0A@ISA =3D qw(Expor=
ter);=0A=0A@EXPORT_OK =3D qw(infinite_loop);=0A=0Ause BecomeUser qw(b=
ecome_user restore_id);=0Ause Reporting qw(failed_report report_and_=
die);=0Ause GetStatusListing qw(get_status_listing);=0Ause Submit =
qw(submit);=0Ause ExecuteScript qw(execute_script);=0Ause EndProcessing=
qw(end_processing);=0Ause PutFiles qw(put_files);=0Ause GetFile=
Chunk qw(get_file_chunk);=0Ause JobControl qw(abort_job cancel_jo=
b hold_job resume_job);=0Ause Dump2File qw(dump2file);=0A=0Ause stri=
ct;=0A=0A# Loop listening for input from NJS and processing it=0A=0A# Write=
s directly to main::CMD_SOCK, reads directly from main::CMD_SOCK=0A=0Asub i=
nfinite_loop() {=0A=0A $/ =3D "ENDOFMESSAGE\n";=0A=0A my $message;=0A=0A=
while ( $message =3D <main::CMD_SOCK> ) {=0A=0A # Strip message =
terminator _and_ untaint the data=0A # I trust the source! and the s=
etuid/setguid is downgrading!=0A if ($message =3D~ m/(.*)(ENDOFMESSA=
GE)/s ) {=0A $message =3D $1;=0A }=0A=0A # Got the=
message, do something about it. =0A=0A # Now find which command=
to execute=0A=0A SWITCH: {=0A=0A # --- Commands =
that do not require a specific user=0A=0A # Are you still th=
ere? from NJS. No execution of commands=0A # just reply with=
blank to NJS, so no need to setuid=0A $message =3D~ /#TSI_P=
ING\n/ && do {=0A last SWIT=
CH;=0A };=0A=0A =
# --- Now switch user for those that should be run as a user=0A=0A =
# Never execute any command as root, always setuid to a user=0A =
# and if this fails abort execution of this command=0A=0A =
# Find which user we should be setting UID to=0A #=
look for the line: #TSI_IDENTITY user_name project name=0A my $user;=0A=
my $project;=0A=0A if($message =3D~ m/#TSI_IDENTITY (\S+) (\S+)/) {=
=0A $user =3D $1;=0A $project =3D $2;=0A }=0A else {=0A f=
ailed_report("No user identity found in: $message ---");=0A last SWITCH=
;=0A }=0A=0A last SWITCH unless become_user($user,$projec=
t) =3D=3D 1;=0A=0A dump2file($message);=0A=0A $message =
=3D~ /#TSI_GETSTATUSLISTING\n/ && do {=0A =
get_status_listing($message);=0A =
last SWITCH;=0A =
};=0A=0A $message =3D~ /#TSI_SUBMIT\n/ && do {=0A =
submit($message);=0A =
last SWITCH;=0A =
};=0A=0A $message =3D~ /#TSI_EXECUTES=
CRIPT\n/ && do {=0A execute=
_script($message);=0A last S=
WITCH;=0A };=0A=0A =
$message =3D~ /#TSI_ENDPROCESSING\n/ && do {=0A =
end_processing($message);=0A =
last SWITCH;=0A =
};=0A=0A $message =3D~ /#TSI_PUTFILES\n/ && do =
{=0A put_files($message);=0A=
last SWITCH;=0A =
};=0A $message =3D~ /#TSI_=
GETFILECHUNK\n/ && do {=0A =
get_file_chunk($message);=0A =
last SWITCH;=0A };=0A=0A =
$message =3D~ /#TSI_ABORTJOB\n/ && do {=0A =
abort_job($message);=0A =
last SWITCH;=0A =
};=0A=0A $message =3D~ /#TSI_CANCELJOB\n/ && do {=
=0A cancel_job($message);=0A=
last SWITCH;=0A =
};=0A=0A $message =3D~ /#T=
SI_HOLDJOB\n/ && do {=0A ho=
ld_job($message);=0A last SW=
ITCH;=0A };=0A=0A =
$message =3D~ /#TSI_RESUMEJOB\n/ && do {=0A =
resume_job($message);=0A =
last SWITCH;=0A =
};=0A=0A failed_report("Unrecognised NJS command: $messag=
e ---");=0A=0A }=0A=0A restore_id();=0A=0A=0A =
$message =3D "";=0A=0A print main::CMD_SOCK "ENDOFMESSAGE\n";=0A=0A=
$/ =3D "ENDOFMESSAGE\n";=0A }=0A=0Areport_and_die("End of inputs=
from NJS, finishing execution");=0A=0Aexit;=0A=0A}=0A#=0A# =
Copyright (c) Fujitsu Ltd 2000 - 2004=0A#=0A# Use and dis=
tribution is subject a License.=0A# A copy was supplied with the distributi=
on (see documentation or the jar file).=0A#=0A# This product includes softw=
are developed by Fujitsu Limited (http://www.fujitsu.com).=0A }=0A=0A =
restore_id();=0A=0A=0A $message =3D "";=0A=0A print=
main::CMD_SOCK "ENDOFMESSAGE\n";=0A=0A $/ =3D "ENDOFMESSAGE\n";=0A =
}=0A=0Areport_and_die("End of inputs from NJS, finishing execution");=0A=
=0Aexit;=0A=0A}=0A#=0A# Copyright (c) Fujitsu Ltd 2000 - =
2004=0A#=0A# Use and distribution is subject a License.=0A# =
A copy was supplied with the distribution (see documentation or the jar fil=
e).=0A#=0A# This product includes software develoirix_sge/PutFiles.pm=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00000755 =00000000 =00000000 =0000000012215 07635345573 014616=00 0=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
ustar=0000root=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00sys=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00000000 =00000000 =00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00package PutFiles ;=0A=0A# Code to bring=
TSI up to NJS 3.6=0A# Reacds mode and disposition information from NJS=0A=
=0Arequire Exporter;=0A@ISA =3D qw(Exporter);=0A=0A@EXPORT_OK =3D qw(put_fi=
les);=0A=0Ause Reporting qw(start_report failed_report ok_report debug_repo=
rt report_and_die);=0Ause Dump2File qw(dump2file);=0A=0Ause strict;=
=0A=0A#=0A# Writes to the NJS COMMAND and DATA sockets=0A=0A# Write files s=
ent by the NJS=0A#=0A# Called in response to a TSI_PUTFILES request from th=
e NJS=0A#=0A# arg1: none=0A#=0A# returns: void to TSI=0A#=0A# take=
s over NJS-TSI protocol to receive files.=0A#=0A=0Asub put_files {=0A=0A =
my $output;=0A my $file_name;=0A my $packet_length;=0A my $left;=
=0A my $offset;=0A my $len;=0A my $bytes;=0A my $written;=0A my $acti=
on;=0A my $from_njs =3D shift;=0A=0A start_report("Receiving files.");=
=0A=0A # Extract the word following the marker=0A ($action) =3D ($fro=
m_njs =3D~ /.*#TSI_FILESACTION (.+)\n/);=0A $action =3D 1 unless length $ac=
tion; # default to new only for old NJSs=0A=0A # OK, ready to go into m=
ode to accept files and data=0A print main::CMD_SOCK "TSI_OK\n";=0A p=
rint main::CMD_SOCK "ENDOFMESSAGE\n";=0A=0A # Read the file name and mod=
e=0A $file_name =3D <main::CMD_SOCK>;=0A chomp $file_name; # =
gets rid of ENFOFMESSAGE=0A $file_name =3D~ s/\n*//g; # Clean new line=
s=0A=0A my $mode;=0A ($file_name,$mode) =3D split " ",$file_name;=0A=0A =
while($file_name ne "-1") {=0A=0A dump2file($file_name);=0A=0A $file_name=
=3D~ s/\$USER/$ENV{USER}/g;=0A $file_name =3D~ s/\$HOME/$ENV{HOME}/g;=0A=
=0A # Untaint (I trust the source)=0A if($file_name =3D~ m/(.*)/s) {=0A =
$file_name =3D $1;=0A }=0A=0A if($mode =3D~ m/(.*)/s) {=0A $mode =3D $=
1;=0A }=0A # What do we do about existing files?=0A if(-e $file_na=
me) {=0A if($action =3D=3D 1) {=0A failed_report("File already exists:=
$file_name\n");=0A return;=0A }=0A }=0A else {=0A if($actio=
n =3D=3D 2) {=0A failed_report("File does not exist: $file_name\n");=0A =
return;=0A }=0A }=0A=0A # Open the file=0A if( !open(OU=
TF, ">$file_name") ) {=0A failed_report("Putfiles cannot open th=
e file for writing: $file_name.");=0A return;=0A }=0A=0A =
print main::CMD_SOCK "TSI_OK\nENDOFMESSAGE\n"; # Put NJS into =
send mode for next command=0A=0A # Read packet length=0A $pac=
ket_length =3D <main::CMD_SOCK>;=0A chomp $packet_length; # =
gets rid of ENFOFMESSAGE=0A $packet_length =3D~ s/\n*//g; # Clean =
new lines=0A=0A# debug_report("Expecting $packet_length bytes for <$=
file_name>"); # here so that NJS gets to read it=0A=0A print main::C=
MD_SOCK "TSI_OK\nENDOFMESSAGE\n"; # Put NJS into send mode for next c=
ommand=0A=0A # Read data=0A while($packet_length > -1) {=0A=
=0A # No EOF in DATA stream, so have to count bytes=0A =
$left =3D $packet_length;=0A while($left >=3D $main::BUFFER_SI=
ZE) {=0A=0A $len =3D read main::DATA_SOCK, $bytes, $main::BU=
FFER_SIZE; # READ FROM THE DATA CHANNEL=0A $left -=3D $len;=
=0A=0A $offset =3D 0; # See Programming Perl p231=0A =
while($len) { # Handle partial writes=0A $writt=
en =3D syswrite OUTF, $bytes, $len, $offset;=0A report_a=
nd_die("Putfiles has fatal write error: $!") unless defined $written;=0A =
$len -=3D $written;=0A $offset +=3D $wr=
itten;=0A }=0A }=0A if($left > 0) { =
=0A=0A $len =3D read main::DATA_SOCK, $bytes, $left; # REA=
D FROM THE DATA CHANNEL=0A=0A $offset =3D 0; # See Programm=
ing Perl p231=0A while($len) { # Handle partial writes=0A =
$written =3D syswrite OUTF, $bytes, $len, $offset;=0A =
report_and_die("Putfiles has fatal write error 2: $!") unles=
s defined $written;=0A $len -=3D $written;=0A =
$offset +=3D $written;=0A }=0A }=0A=0A =
# Read next packet length=0A $packet_length =3D <main=
::CMD_SOCK>;=0A chomp $packet_length; # gets rid of ENFO=
FMESSAGE=0A $packet_length =3D~ s/\n*//g; # Clean new lines=0A=
=0A# debug_report("Expecting $packet_length bytes for <$file_nam=
e>"); # here so that NJS gets to read it=0A=0A print main::CMD_S=
OCK "TSI_OK\nENDOFMESSAGE\n"; # Put NJS into send mode for next comma=
nd=0A=0A=0A }=0A =0A close(OUTF);=0A=0A # Change =
mode of file to NJSs request=0A $mode =3D $mode*64; # that is $mode00 i=
n octal=0A chmod $mode, $file_name; =0A=0A # Read the next fi=
le name=0A $file_name =3D <main::CMD_SOCK>;=0A chomp $file_na=
me; # gets rid of ENFOFMESSAGE=0A $file_name =3D~ s/\n*//g; =
# Clean new lines=0A=0A ($file_name,$mode) =3D split " ",$file_name;=0A=
=0A }=0A=0A ok_report("Putfiles finished executing OK");=0A }=0A#=0A#=
$Id: PutFiles.pm,v 1.16 2002/02/13 14:31:47 svdb Exp $=0A#=0A# 18-10-01 Sv=
en van den Berghe fecit Additional protocol - "action" (always write, overw=
rite only, new only)=0A# 23-07-01 Sven van den Berghe fecit Transfer file m=
ode information=0A# 04-05-01 Sven van den Berghe fecit Created from 3.2 TSI=
for Unicore 3.5=0A#=0A# Copyright 1999 to 2001 Fujit=
su European Centre for Information Technology Ltd.=0A# This is unpublished=
proprietary source code which is the property of Fujitsu European Centre f=
or Information Technology Ltd.=0A#=0A/13 14:31:47 svdb Exp $=0A#=0A# 18-10-=
01 Sven van den Berghe fecit Additional protocol - "action" (always write, =
overwrite only, new only)=0A# 23-07-01 Sven van den Berghe fecit Transfer f=
ile mode information=0A# 04-05-01 Sven van den Berghe fecit Created from 3.=
2 TSI for Unicore 3.5=0A#=0A# Copyright 1999 to 2001 =
Fujitsu European Centre for Information Technirix_sge/Reporting.pm=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00000755 =00000000 =00000000 =0000000006622 07635345573 015041=00 0=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00ustar=
=0000root=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00sys=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00000000 =00000000 =00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00package Reporting;=0A=0Arequire Exporter;=0A@=
ISA =3D qw(Exporter);=0A=0A@EXPORT_OK =3D qw(debug_report failed_report ok_=
report start_report command_report initial_report report_and_die);=0A=0Ause=
strict;=0A=0A# uses values set in the configuration section ($log_to_njs, =
main::CMD_SOCK, $debug)=0A=0A#=0A# Logging subs.=0A#=0A# Destination of log=
entries can be either stdout or=0A# the NJS (plus syslog before NJS connec=
tions made)=0A#=0A# More verbose messaging if "debug" set=0A#=0A=0A# Write =
a string to the current output with a time stamp (internal)=0A#=0A# arg1: s=
tring to write=0A=0Asub report {=0A=0A my $time =3D scalar localtime;=0A=
my $string =3D shift;=0A=0A $string =3D~ s/\s+$//;=0A=0A if($main=
::log_to_njs) {=0A print main::CMD_SOCK "TSI_COMMENT\n$time $string\=
nEND_TSI_COMMENT\n";=0A }=0A else {=0A print "$time $string\n"=
;=0A }=0A=0A}=0A=0A#=0A# Write debug information to current output (if d=
ebug requested)=0A#=0A# arg1: string to write=0A#=0Asub debug_report {=0A =
if($main::debug) {=0A my $string =3D shift;=0A report(" =
$string");=0A }=0A}=0A=0A#=0A# Execution of an NJS request failed, tell=
NJS with appropriate protocol=0A# and also write the message to current ou=
tput=0A#=0A# arg1: failure message=0A#=0Asub failed_report {=0A=0A my $s=
tring =3D shift;=0A=0A # NJS expects a single line, remove any embedded =
new lines=0A $string =3D~ s/\n/:/g;=0A=0A report(" ### Command execut=
ion FAILED");=0A report(" $string");=0A report(" Command was:=
$Reporting::reported_command") if $Reporting::reported_command;=0A repo=
rt(" ### End report command execution FAILED");=0A=0A # Tell NJS=0A p=
rint main::CMD_SOCK "TSI_FAILED: $string\n";=0A=0A}=0A=0A#=0A# Execution of=
an NJS request executed OK, tell NJS with appropriate protocol,=0A# and al=
so write the message to current output (if debugging)=0A#=0A# arg1: debug m=
essage =0A#=0Asub ok_report {=0A=0A my $string =3D shift;=0A=0A repor=
t(" --- Command executed OK");=0A debug_report("$string");=0A=0A # Te=
ll NJS=0A print main::CMD_SOCK "TSI_OK\n";=0A=0A}=0A=0A#=0A# Start of ex=
ecution of a request from NJS, write to current output=0A#=0A# arg1: messag=
e =0A#=0Asub start_report {=0A my $string =3D shift;=0A report(" --- =
$string");=0A}=0A=0A#=0A# This is the command that was executed, report if =
debugging=0A# record for possible printing by a failed command=0A#=0A# arg1=
: the executed command=0A#=0Asub command_report {=0A $Reporting::reporte=
d_command =3D shift; # keep this for use by failed_report=0A debug_repo=
rt("Command is: $Reporting::reported_command");=0A}=0A=0A#=0A# Information =
to log at the start of execution, before=0A# a connection is made to NJS so=
to syslog (one day) or stdout.=0A# (cannot go to NJS because we have not c=
ontacted one yet)=0A#=0A# arg1: message to write=0A#=0Asub initial_report {=
=0A=0A my $string =3D shift;=0A my $time =3D scalar localtime;=0A=0A =
if($main::log_to_njs) {=0A print "$time $string\n"; # shou=
ld be to a system log?=0A }=0A else {=0A print "$time $str=
ing\n";=0A }=0A}=0A=0A#=0A# Something has happened to make this executio=
n=0A# die (assumed that NJS has gone so will log to=0A# syslog). Should not=
ever be called.=0A#=0A# arg1: message to write=0A#=0Asub report_and_die {=
=0A my $string =3D shift;=0A initial_report($string);=0A exit 1;=
=0A}=0A=0A# $Id: Reporting.pm,v 1.14 2001/08/28 16:55:52 svdb Exp $=0A#=0A#=
04-05-01 Sven van den Berghe fecit Created from 3.0 TSI for Unicore 3.5=0A=
#=0A# Copyright 1999 to 2001 Fujitsu European Centre =
for Information Technology Ltd.=0A# This is unpublished proprietary source=
code which is the property of Fujitsu European Centre for Information Tech=
nology Ltd.=0A#=0Aould not ever be called.=0A#=0A# arg1: message to write=
=0A#=0Asub report_and_die {=0A my $string =3D shift;=0A initialirix_s=
ge/Submit.pm=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00000755 =00000000 =00000000 =0000000016411 =
07635442513 014320=00 0=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00ustar=0000root=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00sys=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00000000 =0000=
0000 =00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00package Submit;=
=0A=0A#####################################################################=
##########=0A# Irix 6.5 with Sun GridEngine5.3 installed=0A################=
###############################################################=0A=0Arequir=
e Exporter;=0A@ISA =3D qw(Exporter);=0A=0A@EXPORT_OK =3D qw(submit);=0A=0Au=
se File::Path qw(mkpath);=0A=0Ause Reporting qw(debug_report failed_report =
ok_report start_report command_report report_and_die);=0A=0Ause strict;=0A=
=0A# Submit the script to the BSS=0A=0A# arg 1 =3D The script (this is call=
ed because the script contains the string "#TSI_SUBMIT");=0A#=0A# Returns v=
oid to TSI=0A# on success returns the BSS identifier assigned to th=
e job=0A# on fail return a message =0A#=0A# The "stdfiles" function=
(in EndProcessing.pm) expects the stdout/stderr files =0A# written by the =
job to be in the CWD of theTSI process, the submit here =0A# must ensure th=
is.=0A#=0A=0ABEGIN {=0A # ----------------------------------------------=
----------------------=0A # Create a file name to which scripts are writ=
ten for the submits to=0A # the batch sub-system. This needs to be uniqu=
e as there may be=0A # more than one TSI running, so base on the process=
id.=0A=0A $Submit::tsi_unique_file_name =3D "TSI_temp_file_$$";=0A=0A =
# Always cd to some neutral place when not doing something=0A $Submit:=
:neutral_dir =3D $ENV{PWD};=0A if($Submit::neutral_dir =3D~ m/(.*)/s) {=
=0A $Submit::neutral_dir =3D $1;=0A }=0A=0A}=0A=0Asub submit {=0A=
=0A my $from_njs =3D shift;=0A=0A # Get the information from the NJS =
(embedded as comments)=0A #=0A # Not picking up defnitions of Softwar=
e Resources sent as:=0A # #TSI_SWR<name>=0A=0A # First clear all comm=
and line sections from previous iterations=0A my $jobname =3D "";=
=0A my $outcome_dir =3D "";=0A my $uspace_dir =3D "";=0A my $=
time =3D "";=0A my $memory =3D "";=0A my $nodes =3D =
"";=0A my $processors =3D "";=0A my $fast_fs =3D "";=
=0A my $large_fs =3D "";=0A my $home_fast_fs =3D "";=0A my $=
home_large_fs =3D "";=0A my $queue =3D "";=0A my $email =3D =
"";=0A=0A $_ =3D $from_njs;=0A while(/#TSI_(\S+) (.*)\n/g) {=
=0A $jobname =3D $2 if $1 eq "JOBNAME";=0A $outcome_dir=
=3D $2 if $1 eq "OUTCOME_DIR";=0A $uspace_dir =3D $2 if $1 eq =
"USPACE_DIR";=0A $time =3D $2 if $1 eq "TIME";=0A $m=
emory =3D $2 if $1 eq "MEMORY";=0A $nodes =3D $2 if $=
1 eq "NODES";=0A $processors =3D $2 if $1 eq "PROCESSORS";=0A =
$fast_fs =3D $2 if $1 eq "FASTFS";=0A $large_fs =3D $=
2 if $1 eq "LARGEFS";=0A $home_fast_fs =3D $2 if $1 eq "HOMEFASTFS"=
;=0A $home_large_fs =3D $2 if $1 eq "HOMELARGEFS";=0A $queue =
=3D $2 if $1 eq "QUEUE";=0A $email =3D $2 if $1 eq "=
EMAIL";=0A }=0A=0A start_report("Submitting a job to the BSS");=0A=0A=
# Jobname (source man page)=0A if($jobname eq "NONE" ) {=0A $=
jobname =3D "-N $main::default_job_name";=0A } else {=0A $jobname=
=3D "-N $jobname";=0A }=0A=0A # Queue (source man page)=0A #=0A =
# The IDB will send the queue name of NONE if it is=0A # set up with a=
single queue whose name is "noname"=0A=0A if($queue eq "NONE" ) {=0A =
$queue =3D "";=0A } else {=0A $queue =3D "-q $queue";=0A =
}=0A=0A # Job memory requirements in megabytes, this can be=0A # eith=
er for the whole job, for each processor or=0A # for each node depending=
on how the IDB is set up=0A # (see PER_xxxx_LIMITS)=0A if($memory eq=
"NONE" ) {=0A $memory =3D "";=0A } else {=0A $memory =3D "-l =
h_vmem=3D$memory"."M";=0A }=0A=0A # $time =3D Job time requirement. W=
allclock time in seconds.=0A=0A # Nodes count, NONE implies serial, othe=
rwise a valid number =0A #=0A # $nodes is number of nodes required=0A=
#=0A # $processors (processors per node) is 1 if the system=0A # =
is not an SMP=0A #=0A # Syntax of time limits change depending on if =
executed on application or=0A # command processors.=0A if( ($nodes eq=
"NONE") || ($nodes =3D=3D 1) ) {=0A # Single processor job, nothin=
g parallel requested, run on command procs=0A $nodes =3D "";=0A =
$time =3D "-l h_cpu=3D$time";=0A } else {=0A # Some sort of pa=
rallel resource asked for (including single proc jobs)=0A # so run o=
n application procs. =0A #$nodes =3D "-l mpp_p=3D$nodes" ; # DON'T=
KNOW YET HOW TO SET PE REQ. IN SGE=0A $time =3D "-l h_cpu=3D$time";=
=0A # Note that this makes no allowance for=0A # the time spe=
nt on the command processor, it may be necessary to add=0A # a field=
for this e.g. -Txxxx where xxxxx is large enough to prevent=0A # jo=
bs being killed for exceeding this limit.=0A }=0A =0A # Email =
source: HS=0A if($email eq "NONE") {=0A $email =3D "";=0A } el=
se {=0A $email =3D "-m bea -M $email " ;=0A }=0A=0A # Tell the=
BSS to put the batch job's stdout and stderr=0A # into these files=0A =
my $stdout_loc =3D "-o $outcome_dir/stdout ";=0A my $stderr_loc =3D "-=
e $outcome_dir/stderr ";=0A=0A # cd to the Uspace directory, will write =
a file soon and=0A # this means that there does not need to be a TSI wor=
king=0A # directory=0A if(chdir($uspace_dir) =3D=3D 0) {=0A fa=
iled_report("Could not cd to Uspace $uspace_dir because $!");=0A ret=
urn 0;=0A }=0A=0A # Make sure that the Outcome directory is there for=
the stdout and stderr files=0A mkpath $outcome_dir, 0, 0700 unless -e $=
outcome_dir;=0A chmod 0700, $outcome_dir;=0A=0A # Ignoring all other =
fields=0A=0A my $command =3D "$main::submit_cmd $queue $nodes $email $me=
mory $time $jobname $stdout_loc $stderr_loc $Submit::tsi_unique_file_name";=
=0A=0A command_report($command);=0A=0A open(EMSCRIPT,">$Submit::tsi_u=
nique_file_name");=0A print EMSCRIPT $from_njs;=0A close(EMSCRIPT);=
=0A=0A # debug_report("SCRIPT:\n".$from_njs);=0A=0A # and execute the=
command=0A my $output =3D `($command) 2>&1`;=0A=0A # Parse output=0A=
if($? !=3D 0) {=0A failed_report($output);=0A }=0A else {=
=0A=0A # Succeeded, return Job Identifier=0A # looking for li=
ne Request <xxxx.blah> submitted successfully (want the xxxx)=0A # n=
ote: ? =3D> minimal match in case other "." in string=0A=0A if($outp=
ut =3D~ /your job (.+?) .*/) {=0A my $jobid =3D $1;=0A=0A =
# qsub does not report a failure code so we need to=0A # ch=
eck here that we got an integer. If we did assume=0A # OK, other=
wise report a failure=0A my $res =3D $jobid;=0A $res =
=3D~ s/[0-9]//g;=0A if (length($res) =3D=3D 0 ) {=0A =
debug_report("Job submitted OK. Identifier: $jobid");=0A =
print main::CMD_SOCK "$jobid\n";=0A }=0A else {=0A =
failed_report("Job submit failed?: $jobid $output");=0A =
}=0A }=0A else {=0A failed_report("Request i=
d not found in: $output");=0A }=0A=0A }=0A=0A unlink $Submit::=
tsi_unique_file_name;=0A=0A chdir $Submit::neutral_dir;=0A=0A}=0A=0A#=0A=
# $Id: Submit.pm,v 1.13 2001/08/28 16:55:59 svdb Exp $=0A#=0A# 15.03.2003, =
ported to Irix with SGE5.3 by M. Nazaruk (mirnaz@icm.edu.pl)=0A# =
based on a version for UNICOS=0A#=0A# 04-05-01 Sven van den Berghe fecit =
Created from 3.0 TSI for Unicore 3.5=0A# 21-08-01 Sven van den Berghe fecit=
Fixed neutral dir (cleaned for root too)=0A# 23-08-01 Sven van den Berghe =
fecit (from Mathilde Romberg, FZJ) removed double $jobname=0A#=0A# =
Copyright 1999 to 2001 Fujitsu European Centre for Informatio=
n Technology Ltd.=0A# This is unpublished proprietary source code which is=
the property of Fujitsu European Centre for Information Technology Ltd.=0A=
#=0A based on a version for UNICOS=0A#=0A# 04-05-01 Sven van den Berghe f=
ecit Created from 3.0 TSI for Unicore 3.5=0A# 21-08-01 Sven van den Berghe =
fecit Fixed neutral dir (cleaned for root too)=0A# 23-08-01 Sven van den Be=
rghe fecit (from Mathilde Romberg,irix_sge/Submit.pm.orig=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00000755 =0000=
0000 =00000000 =0000000016437 07635345573 015277=00 0=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00ustar=0000root=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00sys=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00000000 =00000000 =00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00package Submit;=0A=0A#######################################=
########################################=0A# UNICOS=0A#=0A# based on a v=
ersion for the FZJ Cray T90 with help from Mathilde Romberg=0A#=0A# WARNING=
: assumed that that qsub ... -o foo -e bar ....=0A# puts the genera=
ted stdout into a file bnamed foo and stderr into bar=0A# NEEDS TO =
BE CHECKED !!!!!=0A########################################################=
#######################=0A=0Arequire Exporter;=0A@ISA =3D qw(Exporter);=0A=
=0A@EXPORT_OK =3D qw(submit);=0A=0Ause File::Path qw(mkpath);=0A=0Ause Repo=
rting qw(debug_report failed_report ok_report start_report command_report r=
eport_and_die);=0A=0Ause strict;=0A=0A# Submit the script to the BSS=0A=0A#=
arg 1 =3D The script (this is called because the script contains the strin=
g "#TSI_SUBMIT");=0A#=0A# Returns void to TSI=0A# on success return=
s the BSS identifier assigned to the job=0A# on fail return a messa=
ge =0A#=0A# The "stdfiles" function (in EndProcessing.pm) expects the stdou=
t/stderr files =0A# written by the job to be in the CWD of theTSI process, =
the submit here =0A# must ensure this.=0A#=0A=0ABEGIN {=0A # -----------=
---------------------------------------------------------=0A # Create a =
file name to which scripts are written for the submits to=0A # the batch=
sub-system. This needs to be unique as there may be=0A # more than one =
TSI running, so base on the process id.=0A=0A $Submit::tsi_unique_file_n=
ame =3D "TSI_temp_file_$$";=0A=0A # Always cd to some neutral place when=
not doing something=0A $Submit::neutral_dir =3D $ENV{PWD};=0A if($Su=
bmit::neutral_dir =3D~ m/(.*)/s) {=0A $Submit::neutral_dir =3D $1;=
=0A }=0A=0A}=0A=0Asub submit {=0A=0A my $from_njs =3D shift;=0A=0A =
# Get the information from the NJS (embedded as comments)=0A #=0A # =
Not picking up defnitions of Software Resources sent as:=0A # #TSI_SWR<n=
ame>=0A=0A # First clear all command line sections from previous iterati=
ons=0A my $jobname =3D "";=0A my $outcome_dir =3D "";=0A m=
y $uspace_dir =3D "";=0A my $time =3D "";=0A my $memory =
=3D "";=0A my $nodes =3D "";=0A my $processors =3D =
"";=0A my $fast_fs =3D "";=0A my $large_fs =3D "";=0A m=
y $home_fast_fs =3D "";=0A my $home_large_fs =3D "";=0A my $queue =
=3D "";=0A my $email =3D "";=0A=0A $_ =3D $from_njs;=
=0A while(/#TSI_(\S+) (.*)\n/g) {=0A $jobname =3D $2 if $1 =
eq "JOBNAME";=0A $outcome_dir =3D $2 if $1 eq "OUTCOME_DIR";=0A =
$uspace_dir =3D $2 if $1 eq "USPACE_DIR";=0A $time =3D =
$2 if $1 eq "TIME";=0A $memory =3D $2 if $1 eq "MEMORY";=
=0A $nodes =3D $2 if $1 eq "NODES";=0A $processors =
=3D $2 if $1 eq "PROCESSORS";=0A $fast_fs =3D $2 if $1 eq "=
FASTFS";=0A $large_fs =3D $2 if $1 eq "LARGEFS";=0A $hom=
e_fast_fs =3D $2 if $1 eq "HOMEFASTFS";=0A $home_large_fs =3D $2 if=
$1 eq "HOMELARGEFS";=0A $queue =3D $2 if $1 eq "QUEUE";=0A =
$email =3D $2 if $1 eq "EMAIL";=0A }=0A=0A start_repor=
t("Submitting a job to the BSS");=0A=0A # Jobname (source man page)=0A =
if($jobname eq "NONE" ) {=0A $jobname =3D "-r $main::default_job_n=
ame";=0A }=0A else {=0A $jobname =3D "-r $jobname";=0A }=0A=
=0A # Queue (source man page)=0A #=0A # The IDB will send the queu=
e name of NONE if it is=0A # set up with a single queue whose name is "n=
oname"=0A=0A if($queue eq "NONE" ) {=0A $queue =3D "";=0A }=0A=
else {=0A $queue =3D "-q $queue";=0A }=0A=0A # Job memory =
requirements in megabytes, this can be=0A # either for the whole job, fo=
r each processor or=0A # for each node depending on how the IDB is set u=
p=0A # (see PER_xxxx_LIMITS)=0A if($main::is_pvp) {=0A $memory=
=3D "-lM $memory"."Mb";=0A }=0A else {=0A $memory =3D "";=0A =
}=0A=0A # $time =3D Job time requirement. Wallclock time in seconds.=
=0A=0A # Nodes count, NONE implies serial, otherwise a valid number =0A =
#=0A # $nodes is number of nodes required=0A #=0A # $processors=
(processors per node) is 1 if the system=0A # is not an SMP=0A #=0A =
# Syntax of time limits change depending on if executed on application o=
r=0A # command processors.=0A if($nodes eq "NONE" || $main::is_pvp) {=
=0A # PVP or Single processor job, nothing parallel requested, run o=
n command procs=0A $nodes =3D "";=0A $time =3D "-lT $time";=
=0A }=0A else {=0A # Some sort of parallel resource asked for =
(including single proc jobs)=0A # so run on application procs. =0A =
$nodes =3D "-l mpp_p=3D$nodes" ;=0A $time =3D "-l mpp_t=3D$tim=
e";=0A # Note that this makes no allowance for=0A # the time =
spent on the command processor, it may be necessary to add=0A # a fi=
eld for this e.g. -Txxxx where xxxxx is large enough to prevent=0A #=
jobs being killed for exceeding this limit.=0A }=0A =0A # Ema=
il source: HS=0A if($email eq "NONE") {=0A $email =3D "";=0A }=
=0A else {=0A $email =3D "-mb -me -mu $email " ;=0A }=0A=0A =
# Tell the BSS to put the batch job's stdout and stderr=0A # into these=
files=0A my $stdout_loc =3D "-o $outcome_dir/stdout ";=0A my $stderr=
_loc =3D "-e $outcome_dir/stderr ";=0A=0A # cd to the Uspace directory, =
will write a file soon and=0A # this means that there does not need to b=
e a TSI working=0A # directory=0A if(chdir($uspace_dir) =3D=3D 0) {=
=0A failed_report("Could not cd to Uspace $uspace_dir because $!");=
=0A return 0;=0A }=0A=0A # Make sure that the Outcome director=
y is there for the stdout and stderr files=0A mkpath $outcome_dir, 0, 07=
00 unless -e $outcome_dir;=0A chmod 0700, $outcome_dir;=0A=0A # Ignor=
ing all other fields=0A=0A my $command =3D "$main::submit_cmd $queue $no=
des $email $memory $time $jobname $stdout_loc $stderr_loc $Submit::tsi_uniq=
ue_file_name";=0A=0A command_report($command);=0A=0A open(EMSCRIPT,">=
$Submit::tsi_unique_file_name");=0A print EMSCRIPT $from_njs;=0A clos=
e(EMSCRIPT);=0A=0A # and execute the command=0A my $output =3D `($com=
mand) 2>&1`;=0A=0A # Parse output=0A if($? !=3D 0) {=0A failed=
_report($output);=0A }=0A else {=0A=0A # Succeeded, return Job=
Identifier=0A # looking for line Request <xxxx.blah> submitted succ=
essfully (want the xxxx)=0A # note: ? =3D> minimal match in case oth=
er "." in string=0A=0A if($output =3D~ /Request <(.+?)\..*>/) {=0A =
my $jobid =3D $1;=0A=0A # qsub does not report a failu=
re code so we need to=0A # check here that we got an integer. If=
we did assume=0A # OK, otherwise report a failure=0A =
my $res =3D $jobid;=0A $res =3D~ s/[0-9]//g;=0A if (=
length($res) =3D=3D 0 ) {=0A debug_report("Job submitted OK.=
Identifier: $jobid");=0A print main::CMD_SOCK "$jobid\n";=
=0A }=0A else {=0A failed_report("Job =
submit failed?: $jobid $output");=0A }=0A }=0A els=
e {=0A failed_report("Request id not found in: $output");=0A =
}=0A=0A }=0A=0A unlink $Submit::tsi_unique_file_name;=0A=0A ch=
dir $Submit::neutral_dir;=0A=0A}=0A=0A#=0A# $Id: Submit.pm,v 1.13 2001/08/2=
8 16:55:59 svdb Exp $=0A#=0A# 04-05-01 Sven van den Berghe fecit Created fr=
om 3.0 TSI for Unicore 3.5=0A# 21-08-01 Sven van den Berghe fecit Fixed neu=
tral dir (cleaned for root too)=0A# 23-08-01 Sven van den Berghe fecit (fro=
m Mathilde Romberg, FZJ) removed double $jobname=0A#=0A# =
Copyright 1999 to 2001 Fujitsu European Centre for Information Technolo=
gy Ltd.=0A# This is unpublished proprietary source code which is the prope=
rty of Fujitsu European Centre for Information Technology Ltd.=0A#=0A3 2001=
/08/28 16:55:59 svdb Exp $=0A#=0A# 04-05-01 Sven van den Berghe fecit Creat=
ed from 3.0 TSI for Unicore 3.5=0A# 21-08-01 Sven van den Berghe fecit Fixe=
d neutral dir (cleaned for root too)=0A# 23-08-01 Sven van den Berghe fecit=
(irix_sge/tsi=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00000755 =00000000 =000=
00000 =0000000013367 10150143273 013233=00 0=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00ustar=0000root=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00sys=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00000000 =00000000 =00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00require 5.004; # A good idea as versions previous to this have a k=
nown buffer overflow problem=0A=0A# Main Perl entry point for Irix=0A=0A###=
###########################################################################=
#=0A# Irix 6.5 with Sun GridEngine5.3 installed=0A#########################=
######################################################=0A=0A# If you are us=
ing Perl 5.004 or later, then use the FindBin lines. Otherwise=0A# you will=
need to pass the TSI installation directory on the command line=0A# using =
"-I" or modify the line below=0A#use lib "<install directory>";=0A=0Ause Fi=
ndBin qw($Bin); # determines dynamically the directory containing this s=
cript=0A # and from there the module files (which a=
re installed in the same directory)=0Ause lib $FindBin::Bin;=0A=0Ause stric=
t;=0A=0A# The TSI code is split into a number of Perl modules to=0A# allow =
for easier maintenance. The variables set here=0A# are in the "main" sysbol=
table and are referenced in=0A# using modules by starting them with "$main=
::" e.g.=0A# to get at the value of $site_sez_no_holds set here=0A# the met=
hods in JobControl.pm reference it as=0A# $main::site_sez_no_holds=0A#=0Aus=
e Initialisation qw(initialisation);=0Ause MainLoop qw(infinite_loop)=
;=0A=0A# CONFIGURATION <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<=0A=0A# =
This section contains values that need to be set for each site=0A#=0A# Revi=
ew each entry and confirm that the value set here conforms=0A# to site poli=
cies and produces the behaviour that you want from the TSI=0A=0A# Values re=
ad by the functions in the Reporting package=0A$main::debug =3D 1; =
# Produce debug output? 0 =3D no, 1 =3D yes=0A$main::log_t=
o_njs =3D 1; # Send logging to NJS? 0 =3D no (write to s=
tdout), 1 =3D yes=0A=0A# For some debugging it is valuable to see the messa=
ges from=0A# the NJS to the TSI. Set the variable below to 1 to do this.=0A=
# Each message is written to a different file in the initial=0A# working di=
rectory of the TSI process. If the TSI is run as=0A# root the files will be=
written with the ownership of each Xlogin.=0A$main::dump_messages =3D 0;=
=0A=0A# Where to find the NJS, the value on the right hand ofthe expression=
=0A# will be used if there=0A# is nothing on the command line and must be s=
et if you do=0A# not wish to supply the values on the command line (where=
=0A# they are visible to anyone who does a ps)=0A=0A#$main::njs_machine =3D=
shift || "set name for NJS machine";=0A#$main::njs_port =3D shift || "s=
et port for NJS machine";=0A=0A$main::njs_machine =3D shift || "unicore";=
=0A$main::njs_port =3D shift || "2360";=0A$main::my_port =3D shift |=
| "2361";=0A=0A# Where to find the SGE commands used by the TSI=0A$ENV{SGE_=
ROOT}=3D'/opt/sge';=0A=0Amy $sge_dir =3D "/opt/sge/bin/irix6";=0A=0A# impor=
tant! - -S /bin/sh is required, NJS sends TSI an incarnation written in bou=
rne shell but =0A# Sun GridEngine tries to execute =
it with a login shell=0A$main::submit_cmd =3D "$sge_dir/qsub -S /bin/sh ";=
=0A=0A$main::abort_cmd =3D "$sge_dir/qdel -f"; # delete a job fr=
om SGE, returning stdout/stderr=0A$main::cancel_cmd =3D "$sge_dir/qdel -f";=
# delete a job from SGE, deleting stdout/stderr=0A=0A# Do we do =
anything in response to a hold?=0A$main::site_sez_no_holds =3D 1; =
# 0 =3D> holding allowed=0A=0A$main::hold_cmd =3D "$sge_dir/qhold=
"; # suspend execution of a batch job=0A$main::resume_cmd =3D =
"$sge_dir/qrls"; # resume execution of a batch job=0A=0A$main::=
qstat_cmd =3D "$sge_dir/qstat -s prs"; # show _all_ jobs on SGE submit=
ted by TSI=0A=0A# Scripts executed on behalf of the user inherit their envi=
ronment=0A# from the environment of the shell executing this Perl script.=
=0A#=0A# If the TSI is run in setuid mode, then this environment might=0A# =
not be correct for a normal user environment and general security=0A# recom=
mendations are that setuid scripts should be careful about=0A# the environm=
ent supplied to child processes.=0A=0A# Set the child process SHELL variabl=
e to use the shell always used=0A# by the NJS (user tasks with different sh=
ells are grandchildren)=0A# Do not change from sh, but its location might c=
hange=0A$ENV{SHELL}=3D"/bin/sh";=0A=0A# You may want to set this too=0A#$EN=
V{IFS}=3D" \t\n"; # or something like this=0A=0A# The path from a setuid sc=
ript is not the correct user path and=0A# this line should be enabled with =
a suitable path for user level=0A# scripts. This line is a minimal set and =
should be extended with=0A# any site specific values, particularly those ne=
eded for SGE to=0A# work correctly (note that "interesting" scripts are run=
in batch mode=0A# and so SGE should ensure that a proper environment is se=
t for these.=0A# This line just needs to get the scripts into a batch subsy=
stem.)=0A#=0A# Disabling this line passes the TSI user's PATH to the user.=
=0A#$ENV{PATH}=3D":/bin/:/usr/bin/:/usr/ucb/";=0A=0A# Add any other site re=
quired environment variables here or, if they=0A# are xlogin specific value=
s in the becomeuser sub.=0A=0A# A name to be given to batch jobs if the use=
r does not supply one=0A# or if the given one is invalid=0A$main::default_j=
ob_name =3D "UnicoreJob";=0A=0A# END OF CONFIGURATION <<<<<<<<<<<<<<<<<<<<<=
<<<<<<<<<<<<<<<<<<<<<<<=0A=0A# The size of the buffer to use when reading f=
iles from the NJS and=0A# writing files to the NJS, used by GetDirectory an=
d PutFiles=0A$main::BUFFER_SIZE=3D4096;=0A=0A# TSI Identification informati=
on=0A$main::my_version=3D"4.1";=0A$main::my_os=3D"Irix + SGE";=0A=0Ainitial=
isation(); # contact the NJS=0A=0Ainfinite_loop(); # ... and=
process the requests=0A=0A#=0A# $Id: tsi,v 1.13 2001/08/28 16:56:00 svdb E=
xp $=0A#=0A# 15.03.2003, ported to Irix with SGE5.3 by M. Nazaruk (mirnaz@i=
cm.edu.pl)=0A# based on a version for UNICOS=0A#=0A# 04-05-01 S=
ven van den Berghe fecit Created from 3.0 TSI for Unicore 3.5=0A#=0A# =
Copyright 1999 to 2001 Fujitsu European Centre for Informa=
tion Technology Ltd.=0A# This is unpublished proprietary source code which=
is the property of Fujitsu European Centre for Information Technology Ltd.=
=0A#=0A.. and process the requests=0A=0A#=0A# $Id: tsi,v 1.13 2001/08/28 16=
:56:00 svdb Exp $=0A#=0A# 15.03.2003, ported to Irix with SGE5.3 by M. Naza=
ruk (mirnaz@icm.edu.pl)=0A# based on a version for UNICOS=0A#=
=0A# 04-05-01 Sven van den Berghe fecit Created from 3.0 TSI for irix_sge/t=
si_ls=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00000755 =00000000 =00000000 =00000000122=
15 07635345573 013745=00 0=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00ustar=0000root=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00sys=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00000000 =
=00000000 =00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00#=0A# Thi=
s script does directory listing for the NJS writing=0A# the results on stdo=
ut in the format that the NJS expects.=0A#=0A# The NJS is told to use this =
by the IDB incarnation rule for=0A# LIST_DIRECTORY e.g.=0A#=0A# LIST_DIRECT=
ORY=0A# INVOCATION NOT_RECURSIVE [/usr/bin/perl tsi_ls N <TARGET> ]=0A# I=
NVOCATION RECURSIVE [/usr/bin/perl tsi_ls R <TARGET> ]=0A# INVOCATION =
AS_FILE [/usr/bin/perl tsi_ls A <TARGET> ]=0A# END=0A#=0A# You may ne=
ed to add the full path to where the tsi_ls script=0A# is stored.=0A#=0A# T=
his script expects two arguments.=0A#=0A# The first argument of the script =
indicates if the listing=0A# should be of just the file (argument is A), re=
cursive (argument is R) or non-recursive (argument=0A# is any other value).=
=0A#=0A# The second argument is the root file of the listing.=0A#=0A# The f=
ormat of the output is as follows:=0A#=0A# Listing starts with the line:=
=0A#=0A# START_LISTING=0A#=0A# and ends with the line:=0A#=0A# END_LI=
STING=0A#=0A# The files are listed in depth-first order. Each time a sub-=
directory =0A# is found the entry for the sub-directory file is listed an=
d then entries =0A# for all the file in the subdirectory are listed.=0A#=
=0A# The format for each listing line is:=0A#=0A# Character 0 is usu=
ally blank, except:=0A#=0A# If character 0 is '-', then the this=
line contains extra =0A# information about the file described i=
n the previous line. =0A# This line is copied without change int=
o the ListDirectory =0A# outcome entry for the file.=0A#=0A# =
If character 0 is '<', then all files in a sub-directory =0A# =
have been listed and the listing is continuing with the parent =0A# =
directory. This is required even when the listing is non-recursiv=
e.=0A#=0A# Character 1 is 'D' if the file is a directory=0A#=0A# Ch=
aracter 2 is "R" if the file is readable by the Xlogin (effective uid/gid)=
=0A#=0A# Character 3 is "W" if the file is writable by the Xlogin (effe=
ctive uid/gid)=0A#=0A# Character 4 is "X" if the file is executable by =
the Xlogin (effective uid/gid)=0A#=0A# Character 5 is "O" if the file i=
s owned by the Xlogin (effective uid/gid)=0A#=0A# Character 6 is a spac=
e.=0A#=0A# Until the next space is a decimal integer which is the size =
of the file in bytes.=0A#=0A# Until the next space is a decimal integer=
which is the last modification =0A# time of the file in seconds since =
the Unix epoch.=0A#=0A# Until the end of line is the full path name of =
the file=0A#=0A# Every line is terminated by \n=0A#=0A#=0A#############=
##########################################################################=
=0A=0Ause strict;=0A=0A# >>>>>>>>>> Parse command line=0A=0Amy $type =3D sh=
ift;=0A=0Aif($type eq "A") {=0A $main::as_file =3D 1;=0A}=0Aelsif($typ=
e eq "R") {=0A $main::recursive =3D 1;=0A}=0Aelse {=0A $main::recursi=
ve =3D 0;=0A}=0A=0Amy $file_name =3D shift;=0A=0A# Do the (limited) variabl=
e expansion allowed by the NJS=0A=0A$file_name =3D~ s/\$USER/$ENV{USER}/g;=
=0A$file_name =3D~ s/\$HOME/$ENV{HOME}/g;=0A=0A# >>>>>>>>>> Do listing=0A=
=0Aprint "START_LISTING\n";=0A=0Aif(-d $file_name) {=0A if($main::as_file) =
{=0A print_entry($file_name);=0A print "<\n"; # mark th=
e end of directory listing=0A }=0A else {=0A list($file_name);=0A }=0A}=0A=
else {=0A print_entry($file_name);=0A}=0A=0Aprint "END_LISTING\n";=0A=0A=
=0A#=0A# Print the details of one file=0A#=0A# Pre-condition: target is th=
e most recently statted file (details are in "_");=0A#=0Asub print_entry {=
=0A=0A my $target =3D shift;=0A=0A if(-e _) { # skip tricky files, l=
ike soft link pointing to itself=0A # and catch files that d=
o not exist=0A =0A my $is_dir =3D " ";=0A my $is_read =
=3D " ";=0A my $is_write =3D " ";=0A my $is_exec =3D " ";=0A=
my $is_own =3D " ";=0A=0A $is_dir =3D "D" if -d _;=0A =
$is_read =3D "R" if -r _;=0A $is_write =3D "W" if -w _;=0A =
$is_exec =3D "X" if -x _;=0A $is_own =3D "O" if -o _;=0A=0A =
my @stats =3D stat _;=0A =0A my $size =3D @stats[7];=0A =
my $modt =3D @stats[9];=0A=0A print " $is_dir$is_read$is_write$i=
s_exec$is_own $size $modt $target\n";=0A }=0A}=0A=0A#=0A# List a directo=
ry =0A#=0A# Pre-conditions: target _is_ a directory=0A# tar=
get is the most recently statted file (details are in "_");=0A#=0Asub list =
{=0A=0A my $target =3D shift;=0A=0A if(-r _ && -x _ ) {=0A loc=
al *DIR;=0A opendir(DIR, $target); # this has gotta succeed after =
tests above=0A =0A my $entry;=0A while( defined($entry=
=3D readdir(DIR))) {=0A=0A next if $entry =3D~ /^\.\.?$/; # s=
kip . and ..=0A =0A if(-d "$target/$entry") {=0A =
print_entry("$target/$entry"); # need to stat file before prin=
ting entry=0A=0A list("$target/$entry") if $main::recursive;=
=0A=0A print "<\n"; # mark the end of dire=
ctory listing=0A }=0A else {=0A print_=
entry("$target/$entry"); # need to stat file before printing entry=0A =
}=0A =0A }=0A =0A closedir(DIR);=0A=
}=0A}=0A#=0A# $Id: tsi_ls,v 1.16 2002/02/19 15:17:43 svdb Exp $=0A#=0A#=
23-05-01 Sven van den Berghe fecit Created for Unicore 3.5=0A#=0A# =
Copyright 2001 Fujitsu European Centre for Information Techn=
ology Ltd.=0A# This is unpublished proprietary source code which is the pr=
operty of Fujitsu European Centre for Information Technology Ltd.=0A#=0A =
print_entry("$target/$entry"); # need to stat file before pr=
inting entry=0A }=0A =0A }=0A =0A =
closedir(DIR);=0A }=0A}=0A#=0A# $Id: tsi_ls,v 1.16 2002/02/19 15:17:43=
svdb Exp $=0A#=0A# 23-05-01 Sven van den Berghe fecit Created for Unicore =
3.5=0A#=0A# Copyright 2001 Fujitsu European Centre fo=
r Information Techn=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=
=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00
--0OAP2g/MAC+5xKAE--