![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Background execution of a script | Cameron | Shell Programming and Scripting | 2 | 10-03-2007 05:50 AM |
| error during the execution of script | surjyap | Shell Programming and Scripting | 1 | 08-24-2007 08:10 PM |
| Pb with script execution and variables | Cecile | AIX | 1 | 09-15-2006 09:54 AM |
| pb with script execution | Cecile | UNIX for Dummies Questions & Answers | 3 | 09-14-2006 10:37 AM |
| execution of shell script | malaymaru | Shell Programming and Scripting | 5 | 06-13-2005 09:49 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Script execution information
I want to catch the execution information of a script by calling it from another script....
script_main: #! /bin/ksh ksh -x script2.ksh >> tmplog .... but this doesn't give me anything but the error msgs of script in tmplog. can anyone pls suggest which is the right method? The idea is to run the script2 from script1 and catch the log of execution. I went through a similar thread but it doesn't answer my question completely and that too, it's closed already. Thanks in advance! |
|
||||
|
Thanks thestevew,
I didn't know this one.. but this works only when i do: ksh -x script2.ksh >>tmplog 2>&1 at the prompt the same doesn't work for me from the script1.. This is how my script1.ksh looks: if [ ! `ps -e | script2.ksh ] then `ksh -x script2.ksh >> tmplog 2 >&1` else echo "script2 already running" exit 1 fi Also I have quite a few functions that call one another in script2.ksh.. can you pls tell me how can I catch what's happening within a function when script2.ksh is being run? As far as I know, the above gives only the names of the functions in the order they're called... for ex: script2.ksh has variables a,b,c and it has functions f1, f2. f1 calls f2 and in both f1 and f2 there are variables d & e respectively.. when ksh -x script2.ksh >> tmplog 2>&1 is done.. tmplog contains the below: + a=assigned value + b=assigned value + c=assigned value + f1 + f2 ... Your help is much appreciated! Thanks! |
|
||||
|
Thank you so much thestevew and grial.. for your inputs!
here's my code: script1: #! /bin/ksh BBLOG="$HOME/bb_quickview/Log" datestamp=`TZ=EDT+24 date +%m%d%y` retcode=$? if [ `ps -e | grep script1.ksh` ] then stat=`ksh -x script2.ksh` >> $BBLOG/$datestamp.log 2 >&1 echo retcode else echo "Script2 already running" exit 1 fi Script 2: it's 300 line script that fetches different values by connecting to database (Oracle) and writes all these values into an output file that is later emailed. This much is achieved by means of functions: func_read_configfile ##to read the configuration variables func_connectstring ##to read connection information get_counts ## to fetch the desired values from DB and mail them recheck_counts ## to handle exceptions if counts are not available in the database archive ## to zip the output file and save in Archive directory cleanup ## to remove any temporay files pls note that I cannot paste all lines of the code here.. coz i'm writing from a browser that's connected with a server of restricted access. I, in no way, can copy-paste from my script. The whole issue before me is to see how the script2 runs, what happens in each of these functions, what values are assigned to variables (if any) in the functions and thus save all this information.. kind of a "LOG" which helps in tracing errors if anything fails. ERRORs / Concerns: When I run script1.ksh i see all the debug info on the STDOUT rather than in the LOG i want to create. I only am able to redirect the error messages that Script2 generates into the LOG.. :-S I hope this would suffice to pour in your suggestions. Lots of Thanks! |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|