Log file question


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Log file question
# 1  
Old 03-29-2009
Log file question

Hi all

I trying to backup my suse using
Code:
tar czvf backup.tar /home

how can create a log file at the same time monitor on console?
Code:
tar czvf backup.tar /home > log.txt

thanks in adv
jiajin

Last edited by Yogesh Sawant; 03-29-2009 at 02:11 PM.. Reason: added code tags
# 2  
Old 03-29-2009
Use tee(1):
Code:
# tar czvf backup.tar /home 2>&1 | tee -a log.txt

The 2>&1 redirects stderr to stdout so that the error messages go into the log file also, tee sends its input to the console/terminal as well as sending it to the log file, the "-a" appends to the file (equivalent to >>), if you really want to overwrite the log file each time (like >) then remove the "-a".
# 3  
Old 03-31-2009
It help me alot

thank you sir

jiajin
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Solaris log question

Hello, I have a monitoring script on machine A which asks a telnet on port 80 on machine B. Machine B is on Solaris : root@Ma1-fu-mslocwp-1 # uname -a SunOS Ma1-fu-mslocwp-1 5.10 Generic_144488-09 sun4v sparc sun4vI want to know when the telnet command launched from machine A cannot... (5 Replies)
Discussion started by: black_fender
5 Replies

2. HP-UX

Script to monitor /var/opt/resmon/log/event.log file

AM in need of some plugin/script that can monitor HP-UX file "/var/opt/resmon/log/event.log" . Have written a scrip in sh shell that is working fine for syslog.log and mail.log as having standard format, have interrogated that to Nagios and is working as I required . But same script failed to... (3 Replies)
Discussion started by: Shirishlnx
3 Replies

3. Shell Programming and Scripting

Capture all error message in Log file and send the Log file by email

Hi I have a requirement to write a script to capture all errors in a Logfile and send the file in email. If there is any error occurred the subject of email will be ERROR , If there are no error occurred the subject of email will be SUCCESS. So I created a Log file and put the Appropriate... (2 Replies)
Discussion started by: dgmm
2 Replies

4. Shell Programming and Scripting

Delete log file entries based on the Date/Timestamp within log file

If a log file is in the following format 28-Jul-10 ::: Log message 28-Jul-10 ::: Log message 29-Jul-10 ::: Log message 30-Jul-10 ::: Log message 31-Jul-10 ::: Log message 31-Jul-10 ::: Log message 1-Aug-10 ::: Log message 1-Aug-10 ::: Log message 2-Aug-10 ::: Log message 2-Aug-10 :::... (3 Replies)
Discussion started by: vikram3.r
3 Replies

5. UNIX for Dummies Questions & Answers

Question on FTP Error Log

Hello All, Below is the control card or the file which i am using in shell script to mget files from remote machine via FTP. bash-3.00$ cat ftp_ALD_DAC.log open 10.xx.yy.zzz user D00000187 nb8tr4xx2u ascii cd prod/out lcd /Internal_Impact_TT_Input mget ALD*.TXT bye Below is the... (0 Replies)
Discussion started by: Ariean
0 Replies

6. Shell Programming and Scripting

Rename a log file to old, then create a new log file.

Hi all, I have about 15 directories all with exactly the same structure. I have a file in each of them called log.txt. This file sits in /home/ftp/*usernamehere*/ftptransfer/log/ Username here is the only change in each of the 15 directories. I want to create a SIMPLE shell script that... (5 Replies)
Discussion started by: mokachoka
5 Replies

7. Solaris

SFTP log question

On a Sun Solaris 9 box, how do I know what kind of SFTP server is running? And, if someone sftp'ed a file to my box, where is the log file I can check if the sftp session was a successful one or not? (1 Reply)
Discussion started by: fld2007
1 Replies

8. Shell Programming and Scripting

Rename log file according to log file age

Hi Experts, i am new in shell programming. i am having some problem of checking the log file age and rename it. for example: when i run the shell script, the script will check how old is the log file, if the log is already 10 days old(variable). then the log file will rename. hope to... (3 Replies)
Discussion started by: ewawong
3 Replies

9. Shell Programming and Scripting

Post Shell programming: Question about source a file and read data from the file

This is shell programming assignment. It needs to create a file called .std_dbrc contains STD_DBROOT=${HOME}/class/2031/Assgn3/STD_DB (which includes all my simple database files) and I am gonna use this .std_dbrc in my script file (read the data from the database files) like this: .... (3 Replies)
Discussion started by: ccwq
3 Replies

10. UNIX for Dummies Questions & Answers

Newbie question about difference between executable file and ordinary file

Hi, I am newbie in unix and just started learning it. I want to know what is the difference between an executable file and a file (say text file). How to create executable file? What is the extension for that? How to differentiate ? How does it get executed? Thanks (1 Reply)
Discussion started by: Balaji
1 Replies
Login or Register to Ask a Question