SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
Redirect output to file

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
Redirect output to file
Author Message
JJ



Joined: 11 Oct 2005
Posts: 6

Post Redirect output to file Reply with quote

I am trying to execute a simple command-line
application and redirect the output to a file
(e.g. foo.exe >> output.txt). When I try to schedule
this with 27x7, it fails to create the file. I have
tried a simple "Run program or document file", specifying
the command line as "foo.exe >> output.txt" and I have
also tried the "Run Script" option with the JAL script

Dim process_id, number
RunAndWait ("foo.exe >> output.txt", "", 30, process_id)

This script is based on a built-in example, but I
still don't get the output.txt file created.

What could be wrong here?

Thu Oct 13, 2005 10:49 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7963

Post Re: Redirect output to file Reply with quote

Is foo.exe is console application? If this is a graphical application don't expect anything in the output if it doesn't write to console.

: I am trying to execute a simple command-line
: application and redirect the output to a file
: (e.g. foo.exe >> output.txt). When I try to schedule
: this with 27x7, it fails to create the file. I have
: tried a simple "Run program or document file", specifying
: the command line as "foo.exe >> output.txt" and I have
: also tried the "Run Script" option with the JAL script

: Dim process_id, number
: RunAndWait ("foo.exe >> output.txt", "", 30,
: process_id)

: This script is based on a built-in example, but I
: still don't get the output.txt file created.

: What could be wrong here?

Thu Oct 13, 2005 1:04 pm View user's profile Send private message
JJ



Joined: 11 Oct 2005
Posts: 6

Post Re: Redirect output to file Reply with quote

Yes, it's a simple console application that writes
a string to the console, so if I go to a DOS prompt
and enter

> foo.exe

I get

> The date is mm/dd/yy

If I enter

>foo.exe >> output.txt

I get text file named output.txt with the previous text
in the file.

: Is foo.exe is console application? If this is a graphical application don't
: expect anything in the output if it doesn't write to console.


Thu Oct 13, 2005 1:43 pm View user's profile Send private message
JJ



Joined: 11 Oct 2005
Posts: 6

Post Re: Redirect output to file Reply with quote

I just got it to work (kind of). If I create a
batch file that looks like this:

@echo off
foo.exe

and I execute the batch file instead of the command
itself, it does what I want it too. Still, it would
would be nice if there was a way to not have to create
a batch file for every command I want to execute this
way.

Thu Oct 13, 2005 1:53 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7963

Post Re: Redirect output to file Reply with quote

Where have you searched for output.txt?

Have you tried single ">" instead of a ">>"?

Dim process_id, number
RunAndWait ("foo.exe > output.txt", "", 30, process_id)

You can also try

Dim process_id, number
RunAndWait ("cmd /B foo.exe > output.txt", "", 30, process_id)

: Yes, it's a simple console application that writes
: a string to the console, so if I go to a DOS prompt
: and enter

: I get

: If I enter

: I get text file named output.txt with the previous text
: in the file.

Thu Oct 13, 2005 1:54 pm View user's profile Send private message
JJ



Joined: 11 Oct 2005
Posts: 6

Post Re: Redirect output to file Reply with quote

: Where have you searched for output.txt?

I've looked in the "Start In" folder, the folder
where the exe resides, and in the 24x7 folder (and
subfolders)

: Have you tried single ">" instead of a ">>"?

Just tried it, with no luck either in command-line
or script.

Thanks for the suggestions

Fri Oct 14, 2005 4:03 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7963

Post Re: Redirect output to file Reply with quote

What about "cmd /B foo.exe > c:\output.log" Have you tried that?

: I've looked in the "Start In" folder, the folder
: where the exe resides, and in the 24x7 folder (and
: subfolders)

: Just tried it, with no luck either in command-line
: or script.

: Thanks for the suggestions

Fri Oct 14, 2005 4:50 pm View user's profile Send private message
JJ



Joined: 11 Oct 2005
Posts: 6

Post Re: Redirect output to file Reply with quote

Yes, that just makes a command window pop up, but
doesn't actually run the executable.

: What about "cmd /B foo.exe > c:\output.log" Have you tried that?

Mon Oct 17, 2005 2:27 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7963

Post Re: Redirect output to file Reply with quote

Make your executable to write something or at least put it into a batch file that has "pause" command at the end, for example,

;this is foo.bat
foo.exe > c:\output.log
pause

In the job properties enter foo.bat or cmd /B foo.bat. The result sould be the same. When foo complets the DOS command window will remain open untill you press a key.

: Yes, that just makes a command window pop up, but
: doesn't actually run the executable.

Mon Oct 17, 2005 2:53 pm View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.