Capturing log of a shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Capturing log of a shell script
# 1  
Old 12-15-2009
Capturing log of a shell script

Hi,

I have a script which does multiple tasks in sequence. When i execute the script, it runs and displays lot of messages for each of the steps on the console. Is there any way I can capture those messages and store it for audit purposes ?

Best Regards,
bornon2303
# 2  
Old 12-15-2009
Yes, simple. Redirect the STDOUT as,

Code:
script > script_stdout

If you have, messages printed to error also, then,

Code:
script > script_stdout 2 > script_stderr

# 3  
Old 12-16-2009
background script

Hi ,

Thanks for the reply, but what if the script is running in background.
eg: scirpt_name &

Regards,
Nagendra.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script for capturing FTP logs

I have a script #!/bin/bash HOST=ftp.example.com USER=ftpuser PASSWORD=P@ssw0rd ftp -inv $HOST <<EOF user $USER $PASSWORD cd /path/to/file mput *.html bye EOF the script executes sucessfully I need to capture the FTP logs to a logfile should contain FTP Login successful ... (1 Reply)
Discussion started by: rajeshas83
1 Replies

2. Shell Programming and Scripting

Capturing name of the user who is running a shell script

Hello All, I am writing a shell script which will run on build server where multiple users can login.These users can run this script at the same time. I want to capture the name of the user who ran the script for every instance.How can I do that ? Regards,... (1 Reply)
Discussion started by: anand.shah
1 Replies

3. Shell Programming and Scripting

Capturing script output and input to log

Hi Is there a way that I can capture a shell script (both output and input) to a log file where I can analyze it? Thanks (6 Replies)
Discussion started by: nimo
6 Replies

4. Shell Programming and Scripting

Capturing output of procedure in variable in shell script

Hi guys I am calling one DB2 stored proc through unix. It is giving me below output. I want to capture the value 150 in one UNIX variable in shell script. Please let me know how I can achieve this. Thanks in advance Value of output parameters -------------------------- Parameter Name :... (5 Replies)
Discussion started by: vnimavat
5 Replies

5. UNIX for Dummies Questions & Answers

Capturing Input Parameters on Shell Script

i have this basic line of code that doesn't work. i simply want to get the input parameter strings but when the script is run it appears that the first parameter is assigning the value to the second parameter. #!/bin/sh pdir=`pwd` p1=$1 p2=$2 echo "directory: $pdir\n" echo "parameter... (2 Replies)
Discussion started by: wtolentino
2 Replies

6. Shell Programming and Scripting

Capturing Sybase SP output in Shell Script

Greetings, I need to capture the output of a Sybase stored procedure, inside my shell script( k shell). Based on this output, I need to call another perl script, with input arguments as the result set of the procedure execution. I need to keep looping through and call the perl script, ... (2 Replies)
Discussion started by: rajpreetsidhu
2 Replies

7. Shell Programming and Scripting

capturing log

Hi below is my script which copies test file to each directory in the file and checks if the permissions are ok, but I am not able to capture the log of the output. here is the script #! /usr/bin/sh set -x cd /dir/of/files while read line do cp test.txt $line rm $line/test.txt done <... (3 Replies)
Discussion started by: mgirinath
3 Replies

8. Shell Programming and Scripting

Capturing shell script command output

I am trying to check to see if a file exists on a ftp server, well, I know that cant be done, atleast directly, So I came up with this small script ftp -n $HOST <<END_SCRIPT quote USER $USER quote PASS $PASSWD cd public_html/crap dir $FILE quit END_SCRIPT Where the $ variable... (2 Replies)
Discussion started by: designflaw
2 Replies

9. Shell Programming and Scripting

Need help capturing pipe to a file in shell script

The command: echo "this is some text" | shellscript abc def ghi My problem: How to capture "this is some text" so that I can process it, I.e. capture to a file. What I'm attemting to do is process the text echo'd into a file after writing the parameters passed first. No problem... (6 Replies)
Discussion started by: heinz
6 Replies
Login or Register to Ask a Question