How do I iput a file (using irods user) to the $userNameClient space?

183 views
Skip to first unread message

aape...@ncsu.edu

unread,
Apr 14, 2016, 2:53:13 PM4/14/16
to iRODS-Chat
Hi

How do I iput a file (using irods user) to the $userNameClient space?

This is what I am trying to do:  msiExecCmd runs a script which runs a fortran executable. The script, of course is the cmd/ directory and is executed as the irods user.  Output is generated from the executable, and placed into a scratch area, /var/lib/irods/scratch/filename.  Now, how can I make this script (run as irods) iput this file into the userClient directory?

Eg.
 #!/bin/bash
...run script and generate output into  /var/lib/irods/scratch/filename
iput /var/lib/irods/scratch/filename #this works but puts the file into the irods-user space
runuser -l clientUsername -c 'iput -f /var/lib/irods/scratch/filename' #this does not work
su - userName -c 'iput /var/lib/irods/scratch/filename' requires password

Reagan Moore

unread,
Apr 14, 2016, 3:04:14 PM4/14/16
to irod...@googlegroups.com
Consider the following rule which can be run interactively with irule

storeFile {

# execute the rule with irule -F test-StoreFile.r "*File='localfilename'"

# Store report in standard collection with time stamp

  *Coll = "/lifelibZone/home/$userNameClient/Reports";

  isColl(*Coll, "stdout", *Status1);

  if (*Status1 < 0) { fail;}

  *Res = "LTLResc";

  msiGetSystemTime(*Time,"human");

  msiSplitPathByKey (*File, "/", *Col, *File1);

  writeLine ("stdout", "*File, *Col, *File1");

  *Path = "*Coll/*File1" ++ ".*Time";

  *local = "localPath=*File++++forceFlag=";

  msiDataObjPut(*Path, *Res, *local, *Status);

  if (*Status >= 0) {

    writeLine ("stdout", "*File was stored in *Path");

  }

}

isColl (*LPath, *Lfile, *Status) {

  *Status = 0;

  *Query0 = select count(COLL_ID) where COLL_NAME = '*LPath';

  foreach(*Row0 in *Query0) {*Result = *Row0.COLL_ID;}

  if(*Result == "0" ) {

    msiCollCreate(*LPath, "1", *Status);

    if(*Status < 0) {

      writeLine("*Lfile","Could not create *LPath collection");

    }  # end of check on status

  }  # end of log collection creation

}

INPUT *File="/Users/reagan/Documents/copy/UNC/iRODS-Course/2016/rules/test"

OUTPUT ruleExecOut


However, if you are running an external script, you can add an iput command to your external script.


iput –f  /var/lib/irods/scratch/filename      data-grid-file-name


Reagan Moore


--
--
"iRODS: the Integrated Rule-Oriented Data-management System; A community driven, open source, data grid software solution" https://www.irods.org
 
iROD-Chat: http://groups.google.com/group/iROD-Chat

---
You received this message because you are subscribed to the Google Groups "iRODS-Chat" group.
To unsubscribe from this group and stop receiving emails from it, send an email to irod-chat+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

aape...@ncsu.edu

unread,
Apr 22, 2016, 12:47:22 PM4/22/16
to iRODS-Chat

On the icat server, it works, but not on the client:
The script is on the server and is run as the irods user, putting output into server:/var/lib/irods/scratch
msiDataObjPut("dsai_ncsu/home/username/output",*Res,"/var/lib/irods/scratch/output++++forceFlag=",*Status);
works, if the irule is done on the icat server, because it can find /var/lib/irods/scratch/output

However, on the client, it does not work because it cant find server:/var/lib/irods/scratch/output because it is not local.  I tried using the filePath keyword in the msi service, but that did not work:
msiDataObjPut("dsai_ncsu/home/username/output",*Res,"filePath=/var/lib/irods/scratch/output++++forceFlag=",*Status);

If I put "iput -f /var/lib/irods/scratch/output" in the script, it kind of works, but it puts it into the irods-user zone, not the client-user zone (because the script is executed as the irods user).

Any ideas?  Is there a way either to 1) get msiDataObjPut -when run from the client- to grab a file from the server scratch area or 2) get iput to iput to a different users zone?

Andrew

Reagan Moore

unread,
Apr 22, 2016, 1:07:24 PM4/22/16
to irod...@googlegroups.com
One way is to identify the resource where the file is located, and use a remote command to execute the msiDataObjPut at that resource.

Also, if your are storing the file into a different zone, you will need to use that zone name for the collection path.
Reply all
Reply to author
Forward
0 new messages