Skip to content
Snippets Groups Projects
Commit cc7fc3f4 authored by Staiger, Christine's avatar Staiger, Christine
Browse files

Delete tarCollection.r

parent 84449704
No related branches found
No related tags found
No related merge requests found
tarCollection{
msiGetObjType(*coll, *objType);
*s = size(split(*coll, "/")); #path level needs to be deeper than /zone/home/user
msiGetObjType(*resource, *rescType)
if(*objType != "-c"){
writeLine("stderr", "ERROR tarCollection: *coll not a collection.");
msiGoodFailure()
}
if(int(*s) < 4){
writeLine("stderr", "ERROR tarCollection: cannot bundle root or home of users.");
msiGoodFailure()
}
if(*rescType != "-r"){
writeLine("stderr", "ERROR tarCollection: *resource not a resource.");
msiGoodFailure()
}
#get size of collection
*size1 = 0;
*size2 = 0;
*rescSize = 0;
foreach(*row in SELECT sum(DATA_SIZE) where COLL_NAME like "*coll/%"){
*size1 = int(*row.DATA_SIZE);
}
foreach(*row in SELECT sum(DATA_SIZE) where COLL_NAME like "*coll"){
*size2 = int(*row.DATA_SIZE);
}
*size = *size1 + *size2;
if(*size == 0){
writeLine("stderr", "ERROR tarCollection: Empty coll *coll, no data to tar.")
msiGoodFailure()
}
writeLine("stdout", "DEBUG tarCollection: Coll size: *size");
foreach(*row in SELECT RESC_FREE_SPACE where RESC_NAME like *resource){
*rescSize = int(*row.RESC_FREE_SPACE);
}
writeLine("stdout", "DEBUG tarCollection: Resc size: *rescSize.");
if(*rescSize < *size*2-*rescSize/10){
writeLine("stderr", "ERROR tarCollection: Not enough space on *resource");
msiGoodFailure()
}
msiSplitPath(*coll, *parentColl, *collName);
if(bool(*compress)){
*tarFile = "*parentColl/*collName.zip"
}
else {*tarFile = "*parentColl/*collName.irods.tar"}
writeLine("stdout", "Create *tarFile");
msiArchiveCreate(*tarFile, *coll);
if(bool(*delete)){
msiRmColl(*coll, "forceFlag=", *out);
writeLine("stdout", *out);
}
*tarFile
}
input *coll="/npecZone/home/cstaiger/TEST", *resource="disk", *compress="false", *delete="false"
output ruleExecOut
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment