Islam
Islam

Reputation: 55

How to run Unix command from Oracle Forms

OS: UNIX Solaries, Oracle Application Server 10g

To run shell script from Oracle Forms, I used the following host('/bin/bash /u01/compile.sh') and it works well

Now, I need to run unix command something like

host('mv form1.fmx FORM1.FMX') but it's not working

I tried to append the command mv form1.fmx FORM1.FMX' to the compile.sh shell script but also it's not working although the rest lines of the shell script is running well

Upvotes: 0

Views: 4411

Answers (2)

Timekiller
Timekiller

Reputation: 3136

In case anyone else encounters the same problem, the cause is that Forms process creates a subprocess to execute host() command, and that subprocess inherits environment variables of the parent process, which are derived from default.env (or other env file as defined in server config). There is a PATH variable defined in that file, but it doesn't contain usual /bin or /usr/bin, so the commands will not execute unless full path is specified.

The solution is to set the correct PATH variable either in the executed script (via export PATH=$PATH:...) or in default.env. I set it in the script, since, knowing Oracle, there's no guarantee that modifying default.env won't break something.

Upvotes: -1

Islam
Islam

Reputation: 55

The solution is to just add the full path of the mv command and it worked well, as follow

/bin/mv /u01/oracle/runtime/test/form1.fmx /u01/oracle/runtime/test/FORM1.FMX

Upvotes: 1

Related Questions