0

On a Unix server, I am running an application engine via the process scheduler. In it, I am attempting to use a "zip" Unix command from within an "Exec" pplcode function.

However, I only get the error

PS_Exec(P): Error executing batch command with reason: No such file or directory (2) I have tried it several ways. The most logical approach I thought was to change directory back to the root, then change to the specified directory so that I could easily use the zip command, such as the following...

Exec("cd / && cd /opt/psfin/pt850/dat/PSFIN1/PYMNT && zip INVREND INVREND.XML");


1643 12.20.34 0.000048 72: Exec("cd /opt/psfin/pt850/dat/PSFIN1/PYMNT");
1644 12.20.34 0.001343 PS_Exec(P): Error executing batch command with reason: No such file or directory (2)

I've even tried the following....just to see if anything works from within an Exec...

Exec("ls");

Sure enough, it gave the same error.

Now, some of you may be wondering, does the account that is associated with the process scheduler actually have authority on this particular directory path on the server ? Well, I was able to create the xml file given in the previous command with no problems.

I just cannot seem to be able to modify it with the Exec issuance of Unix commands. I'm wondering if this is an error of rights and permissions from the unix server with regards to the operator id that the process scheduler is running from. However, given that it can create and write to a file there, I cannot understand why the Exec command would be met with any resistance....Just my gut shot in the dark...

Any help would be GREATLY appreciated!!!

Thanks, Flynn

zeroBelief
  • 21
  • 1
  • 8
  • I realized that my code and error was ambiguous. The Exec statement showed three chain commands on one line, where as the error response only shows one. Please forgive, as I am sure you can understand, I have been through many iterative attempts at a variety of code to try to get it working. - Flynn – zeroBelief Sep 16 '14 at 17:13
  • hmmm, I might be totally off on this and haven't dealt with execs on PS for years and even then only on Windows. But... shouldn't you indicate that you are calling bash or whatever shell you are using, before using shell commands? On Windows or from SQR, you usually see people forgetting to indicate that cmd.exe is the targetted shell before running things like mkdir. Yes, realize that is not a complete answer, but maybe it'll point you in the right direction. – JL Peyret Sep 18 '14 at 20:23

1 Answers1

1

Not sure if you're still having an issue, but in your Exec code, adding the optional %FilePath_Absolute constant should help. When that constant is left off, PS automatically prefixes all commands with <PS_HOME>. You'll have to specify absolute paths with this flag on though. I've changed the command to something that should work.

Exec("zip /opt/psfin/pt850/dat/PSFIN1/PYMNT/INVREND /opt/psfin/pt850/dat/PSFIN1/PYMNT/INVREND.XML", %FilePath_Absolute);

The documentation at PeopleBooks is a little confusing sometimes, but it explains it fairly well in this case. You can always store the absolute location in a variable and prefix that to your commands so you don't have to keep typing out /opt/psfin/pt850/dat/PSFIN1/PYMNT/.