Home » Developer & Programmer » Forms » 10g host cmd
10g host cmd [message #420419] Sat, 29 August 2009 06:57 Go to next message
jai_g
Messages: 23
Registered: July 2009
Location: India
Junior Member
Dear,

I wanted to transfer a batch file from client application server and the batch file hast to run from application server.

The was transfrred succesfully, but batch file from application server was no run.

The code:

--file transfer----
BEGIN
	I_BARE_FILENAME := SUBSTR(:hdr1.FILENAME,INSTR(:FILENAME,'\',-1)+1);
	
	I_SUCCESS_bat := WEBUTIL_FILE_TRANSFER.CLIENT_TO_AS_WITH_PROGRESS
	((SUBSTR(:FILENAME,1, INSTR(:FILENAME,'\',-1))||'SRITC'||UNIT||'.bat'), 'E:\TEMP\'||'SRITC'||UNIT||'.bat',
	'UPLOAD TO APPLICATION SERVER IN PROGRESS',
	'PLEASE WAIT');
	
	IF I_SUCCESS_bat THEN 
		MESSAGE ('BAT FILE UPLOADED SUCCESSFULLY TO THE APPLICATION SERVER');
	ELSE
		MESSAGE ('BAT FILE UPLOADING TO APPLICATION SERVER FAILED');
	END IF;
	
	EXCEPTION
		WHEN OTHERS THEN
		MESSAGE ('FILE UPLOADED FAILED:'||SQLERRM);
	END;

-----host run-----
Declare
  bat_file varchar2(100);
Begin
  bat_file := ('E:\TEMP\SRITC'||UNIT||'.bat');

  HOST(bat_file);
  
exception
	when others then
	message('bat not invoked'||sqlerrm);
	message('bat not invoked'||sqlerrm);
  
End;

please help..

[EDITED by LF: applied [code] tags]

[Updated on: Sat, 29 August 2009 15:25] by Moderator

Report message to a moderator

Re: 10g host cmd [message #420444 is a reply to message #420419] Sat, 29 August 2009 15:27 Go to previous messageGo to next message
Littlefoot
Messages: 20891
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Did you get any error message? If so, which one? If not, remove WHEN OTHERS and run it again. What happens then?
Re: 10g host cmd [message #420463 is a reply to message #420444] Sun, 30 August 2009 01:28 Go to previous messageGo to next message
jai_g
Messages: 23
Registered: July 2009
Location: India
Junior Member
Dear,

I did your instruction.I did not get any error and the problem exist.

give further help.
Re: 10g host cmd [message #420521 is a reply to message #420419] Mon, 31 August 2009 01:59 Go to previous messageGo to next message
c.schoeberl
Messages: 22
Registered: August 2009
Junior Member
jai_g wrote on Sat, 29 August 2009 06:57


-----host run-----
Declare
bat_file varchar2(100);
Begin
bat_file := ('E:\TEMP\SRITC'||UNIT||'.bat');

HOST(bat_file);

exception
when others then
message('bat not invoked'||sqlerrm);
message('bat not invoked'||sqlerrm);

End;[/code]
please help..

[EDITED by LF: applied [code] tags]


Try this in your starting area:

HOST('call '||bat_file);

or

HOST('start '||bat_file);

[Updated on: Mon, 31 August 2009 01:59]

Report message to a moderator

Re: 10g host cmd [message #420535 is a reply to message #420521] Mon, 31 August 2009 03:27 Go to previous messageGo to next message
jai_g
Messages: 23
Registered: July 2009
Location: India
Junior Member
Hai,

I tried both the option as your instruction. The problem still exist.

For testing purpose i tried this

Host('del '||bat_file);

The file gets deleted from application server.But host command not running. Please suggest else.

[Updated on: Mon, 31 August 2009 03:28]

Report message to a moderator

Re: 10g host cmd [message #420550 is a reply to message #420419] Mon, 31 August 2009 04:57 Go to previous messageGo to next message
c.schoeberl
Messages: 22
Registered: August 2009
Junior Member
so you are able to delete the file on the Applictaion Server. Mabe your command file is not correct. I tested the same thing with my 10g application server and it works.

for output you could try this

HOST('call '||bat_file|| '>> E:\TEMP\SRITC'||UNIT||'.log');


and you would see if the file is Started when a log file exist

[Updated on: Mon, 31 August 2009 04:58]

Report message to a moderator

Re: 10g host cmd [message #420642 is a reply to message #420550] Tue, 01 September 2009 03:22 Go to previous messageGo to next message
dayang_aziz@yahoo.com
Messages: 19
Registered: August 2009
Junior Member
Hi All;

Seems like I have similar problem.
I have a shell script to send email. I manage to run the script when I telnet to the server and called the script directly and I got email in my inbox.

However, when I call the script through froms when trigger WHEN-BUTTON-PRESSED, the script ran but I didnt get the email.

Here is the script:
Quote:
#!/bin/ksh

# --------------------------------------------------------------------
# Script: unix_mail_withattachments.ksh
# Aurthor: Ravin Maharaj
# Purpose: Use sendmail to e-mail messages from Unix with
# --------------------------------------------------------------------

mkdir start

SUBJ="Send mail from Unix with file attachments"
TO=dayangku.masmaryam@lityan.com.my
CC=dayangku.masmaryam@lityan.com.my
(
cat << !
To : ${TO}
Subject : ${SUBJ}
Cc : ${CC}
!
cat << !
HOPE THIS WORKS
Hello world.
!

) | sendmail ${TO} ${CC}

mkdir ${TO}


There are two directory created at the server name start and dayangku.masmaryam@lityan.com.my.

This is the code at trigger:
Quote:
HOST('cd /home/oramid/dayangTest; ./sendmail2.sh');


could anyone help me regarding this.

Regards,
Dayang
Re: 10g host cmd [message #420645 is a reply to message #420419] Tue, 01 September 2009 04:02 Go to previous messageGo to next message
c.schoeberl
Messages: 22
Registered: August 2009
Junior Member
Hello,

i had the same Problem, weeks ago. The Problem i had was that, when i started the file manual, it works and when i let a task start the cmd it dont start. My Problem was that the system or other users are not able to read the global path. so try this. At the begin of the file set all path you need like

Set Path=D:\Server 


this is just an example
Re: 10g host cmd [message #420731 is a reply to message #420645] Tue, 01 September 2009 20:20 Go to previous messageGo to next message
dayang_aziz@yahoo.com
Messages: 19
Registered: August 2009
Junior Member
Hi c.schoeberl,

Thanks for your suggestion. Actually the shell script is successfully executed because the directories were created. It just, the sendmail function wasn't work.

When I telnet to the server and call the shell script, an email was successfully sent to my email address and the directories were also created.

Please advise.

Regards,
Dayang
Re: 10g host cmd [message #421607 is a reply to message #420550] Wed, 09 September 2009 07:08 Go to previous messageGo to next message
jai_g
Messages: 23
Registered: July 2009
Location: India
Junior Member
Hai,

Sorry for delayed replay, I tried this option also. But the log was 0 bite and the problem still exist.

Pl advice some other option to over come this.
Re: 10g host cmd [message #423043 is a reply to message #421607] Mon, 21 September 2009 20:46 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
These 'host' commands run in a NEW session. You have to establish the environment (paths, etc) so that the executables can be found and it can call its subordinate bits and pieces. You also have to make sure that the new session has the correct permissions.

David
Re: 10g host cmd [message #423141 is a reply to message #423043] Tue, 22 September 2009 05:25 Go to previous messageGo to next message
dayang_aziz@yahoo.com
Messages: 19
Registered: August 2009
Junior Member
Thanks David for the response. Im sorry because Im not really understand the solution that you gave since Im not familiar with unix.
Could you please elaborate more or give any url to the details that I can refer to.
I believe the script was execute because there are directories created. Please advise if Im wrong.

Regards,
Dayang.
Re: 10g host cmd [message #423404 is a reply to message #423141] Thu, 24 September 2009 00:46 Go to previous message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
I also do not do Unix. However, like myself I expect that you do have someone at your facility that does do Unix. Talk with them.

You can run tests wherein you direct the command in the 'host' statement to a file and compare the results with that which you get from your Unix command prompt. Start with 'pwd' and 'path' and go from there.

David
Previous Topic: Want to get image name from specified folder on hard desk
Next Topic: Master Detail Form Error
Goto Forum:
  


Current Time: Sat Dec 03 14:10:01 CST 2016

Total time taken to generate the page: 0.05543 seconds