Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error Using HOST builtin

Status
Not open for further replies.

celispb

Programmer
Apr 3, 2003
18
US
I am trying to execute a Unix script in forms 9i using the HOST Builtin.

My test unix script copies a file and moves another file to a subdirectory.

The script works when executed from the Unix command line but is not but the form.

I can run some simple commands through the form like echo test > test.txt but I can not copy files or run unix scripts.

Any ideas?

Thanks


 
Qualify the full path of the script you want to run in the form.
 
Also, I am not getting any error messages or codes that I see. I display the ERROR_CODE and ERROR_MESSAGE but they are 0 and NULL respectively.

Here is my trigger code
Code:
DECLARE
   l_error_txt VARCHAR2(200);
   l_error_code VARCHAR2(10);
  -- l_command    VARCHAR2(100) := 'ls > testhost.txt'; --'. /testhost/test_script.ksh';
BEGIN
   HOST(:control.nbt_command);
   l_error_txt := ERROR_CODE;
   IF FORM_SUCCESS THEN
   	  call_alert('message good');
   ELSE
   	  call_alert(:control.nbt_command || ' ' || l_error_txt);
   END IF;
END;
All the directories I am writing to and files that I am trying to copy and move all have rwx permissions set.

Thanks again.
 
Are the permissions set to rwxrwxrwx including the directory of the script you are trying to run?

Whats in :control.nbt_command?

HOST will not return any error codes because it has no knowledge of the external commands. As far as forms is concerned HOST completed successfully.
 
You should also take into account that all commands are executed with priviledges of user who started Forms server. Does he have all necessary permissions to run that script?

Regards, Dima
 
:control.nbt_command is a text item on the form so I can type in unix commands to execute.

All files and directories have been chmod-ed to 777.

I have tried to execute the script with the full path.

The user does have privileges to run the script and to write to test directory.

Another odd thing. Running this command ls -l > test.txt creates an empty test.txt file even there are files in the directory.

Thanks for the help.

Any more ideas?
 
In any directory I test this in.

Here is the directory structure I am currently trying to test in and the set permissions and owner

/u01 owned by oratest drwxrwsr-x
/u01/product owned by appltest drwxrwsr-x
/u01/product/tips owned by appltest drwxrwsrwx
/u01/product/tips/forms owned by appltest drwxrwsrwx

The test form is in /u01/product/tips/forms .

I thought they were all 777 but owner and group have read, write and execute.

In the forms subdirectory, there are 68 files. When I execute my test form and execute the ls -l > test.txt command, it will create a file test.txt owned by appltest but will be empty.

I am assuming that because the owner of the empty test.txt file is appltest, that is the unix id that is running the form.

Let me know if there is any more information. Thanks
 
Make sure WORLD has rwx as well. As Dima has already pointed out, the owner of the IAS services may well be in a different group to the owner of the original script, files and directories.
 
I guess what I don't understand is, if it is a permission problem why is user appltest able to create a zero byte file in the first place?

If appltest does not have permission to create a file because oratest owns /u01 then appltest would not be able to create a file at all, right?

How can I find out who IAS owner is?

There must be some error code being returned because FORM_SUCCESS is being set.

Thanks for the responses on this I really appreciate it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top