Easiest way to send output to a debug file?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Easiest way to send output to a debug file?
# 1  
Old 02-15-2006
Easiest way to send output to a debug file?

I have this in my script:

Code:
DEBUG_DIR=/log/rotate_output
DEBUGLOG=${DEBUG_DIR}/rotate.${TIMESTAMP}


SERVER_FILE_LIST="\
wasint0206  /logs/squid_backup
wasint0201  /logs/squid_backup"


/usr/bin/echo "${SERVER_FILE_LIST}" | while read SERVER DIRECTORY
do
    cd /log/squid_logs/${SERVER}
    rm /log/squid_logs/${SERVER}/access.log
    /usr/local/bin/scp  ${SERVER}:${DIRECTORY}/access.log.${TIMESTAMP}-12AM.gz log/squid_logs/${SERVER}
    /usr/bin/gunzip /log/squid_logs/${SERVER}/access.log.${TIMESTAMP}-12AM.gz
    /log/squid_logs/convert.sh /log/squid_logs/${SERVER}/access.log.${TIMESTAMP-12AM >> /log/squid_logs/${SERVER}/access.log.${TIMESTAMP}.convert
    /usr/bin/gzip -f /log/squid_logs/${SERVER}/access.log.${TIMESTAMP}.convert
    rm /log/squid_logs/${SERVER}/access.log.${TIMESTAMP}-12AM
done

How would I get all the output from that do loop to go to the debug file that I set up at the top? I know I could put a > ${DEBUGLOG} at the end of every line but is there an easier way to do it? Is there a way to create a dated output file from the crontab? That way the whole program could be done in one shot.
LordJezo
# 2  
Old 02-15-2006
Code:
........................

{
/usr/bin/echo "${SERVER_FILE_LIST}" | while read SERVER DIRECTORY
do
    cd /log/squid_logs/${SERVER}
    rm /log/squid_logs/${SERVER}/access.log
    /usr/local/bin/scp  ${SERVER}:${DIRECTORY}/access.log.${TIMESTAMP}-12AM.gz log/squid_logs/${SERVER}
    /usr/bin/gunzip /log/squid_logs/${SERVER}/access.log.${TIMESTAMP}-12AM.gz
    /log/squid_logs/convert.sh /log/squid_logs/${SERVER}/access.log.${TIMESTAMP-12AM >> /log/squid_logs/${SERVER}/access.log.${TIMESTAMP}.convert
    /usr/bin/gzip -f /log/squid_logs/${SERVER}/access.log.${TIMESTAMP}.convert
    rm /log/squid_logs/${SERVER}/access.log.${TIMESTAMP}-12AM
done

} > myDebugFile.txt
........................

# 3  
Old 02-17-2006
Ha.

Thanks so much.
LordJezo
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Send output of time command to file

I am measuring the time it takes for a wget command to complete. Right now my command is: time wget https://`ifconfig -a | grep '32.29.120' | cut -d: -f2 | cut -d' ' -f1`:8443/primary-rest/shop?brandId=test --header="name: test" --no-check-certificate -o SELF_TEST.log The output I get is ... (2 Replies)
Discussion started by: Junaid Subhani
2 Replies

2. Shell Programming and Scripting

Compare 2 files the send output to a file

Hallo Friends, I would like to compare two files, then write the difference between the two into output file then find a pattern then search for that pattern. -bash-3.2$ cat BS_Orig_20141112.csv|head -20 BW0159574451211141638275086@196.35.130.5 BW02043750712111491637691@196.35.130.5... (2 Replies)
Discussion started by: kekanap
2 Replies

3. Shell Programming and Scripting

Send mdfind output into script file

I'm using mdfind to list images according to their orentation, thus:- mdfind " kMDItemOrientation == 1" -onlyin "/Users/me/Documents/STUDY/AskForum" which outputs /Users/me/Documents/STUDY/AskForum/01 (5).jpg /Users/me/Documents/STUDY/AskForum/01 (4).jpg... (3 Replies)
Discussion started by: waggs
3 Replies

4. Shell Programming and Scripting

Read file, send to dig, no output

From the command line I am running the following command: for i in $(awk '{print ($1)}' src-dst|uniq); do dig -x "$i" +short; done src-dst has a list of IP addresses. When this script is running and I do a ps -ef | grep dig, I see the proper dig command with IP addresses being run, but the... (2 Replies)
Discussion started by: phish
2 Replies

5. Shell Programming and Scripting

bash: How to send the output to a file upon users' request?

Let's say I have a script which creates a report. I use getopts to have different options available to the user. One of these options is -f which basically exports the output of script to a text file which user may give the name of that text file. How can I output the result to the requested file.... (3 Replies)
Discussion started by: bashily
3 Replies

6. Shell Programming and Scripting

Want ro capture the debug in output file

I want to capture the debug for the below command in output file . i tried like this but its not working: sh -xv <scriptname> >> output.log i want the output in a log file. Anyone plz help in this (2 Replies)
Discussion started by: chakkaravarthy
2 Replies

7. Shell Programming and Scripting

Expect debug output

Hi! I want to start OO in headless mode via expect - the oo command would be su - root -c "/usr/lib/openoffice/program/soffice -headless -nofirststartwizard -norestore -nolockcheck -nocrashreport -nodefault -accept='socket,host=0.0.0.0,port=8100;urp;StarOffice.Service'" and the expect... (2 Replies)
Discussion started by: senior.weber
2 Replies

8. UNIX for Dummies Questions & Answers

send output of a file as input for changing date

Hi, Please help me out on this one. I want to send the output of a file as input for changing the date using date command. Example, i have a file date.txt whose contents are 081014462009 I need to use the date in that file as input for date command. I tried cat date.txt | date ; but it... (2 Replies)
Discussion started by: foxtron
2 Replies

9. Shell Programming and Scripting

capture output of file and send last string thereof to new file

Hello, If I run a program from within shell, the output is displayed in the command line terminal. Is there a way I can capture that output and choose only the very last string in it to send it to a new file? Thank you (6 Replies)
Discussion started by: Lorna
6 Replies

10. UNIX for Dummies Questions & Answers

Easiest way to cat out first 100 lines of a file into a different file?

Not sure how to do this exactly.. just want to take the first 100 lines of a file and cat it out into a second file. I know I can do a more on a file and > it into a different file, but how can I make it so only the first 100 lines get moved over? (1 Reply)
Discussion started by: LordJezo
1 Replies
Login or Register to Ask a Question