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!

log redirection

Status
Not open for further replies.

jeysun

Technical User
Nov 19, 2001
1
US
Hi,
It will be nice if somebody give me some tips how to handle this .
I am running a script in cron which redirects the stderr and stdout to a file using
scrip >file.log 2>&1

But,sometimes I need to interact with the output like answer the question Y or N to proceed the script.But I can't do this using this type of log redirection.

Can anybody suggest some better way of doing this?

Jeysun
 
you can redirect just the STND error like this:

# script 2> error.log

all the STND out (prompts for questions) will function as normal.

crowe
 
If my reading is correct, it's the fact that it's running in cron that's causing the problem in terms of it's lack of interactivity. If that is the case, wouldn't an if..then.. else or case construct (depending on how many eventualities there are likely to be) be a better way of handling this?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top