LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 12-02-2005, 03:29 AM   #1
Lotharster
Member
 
Registered: Nov 2005
Posts: 144

Rep: Reputation: 15
"tar: Removing leading `/'..." - message


I'm aware that this came up before, but I do not like the solutions suggested.

My problem is:

I run a backup script from cron which uses tar to archive a directory. I redirected stdout to a logfile, but I still get a email everytime the backup starts with the line "tar: Removing leading `/' from member names".
I think that is because this message is sent to stderr instead of stdout. I don't want to run tar with the -P option. Another solution would be to send stderr to stdout and use "grep -v ..." to weed out the line, but in that case all error messages would go to the log file. But I'd like to receive important error messages via email.
Is there a way to pipe stderr through grep without rediorecting it to stdout?

Any ideas are appreciated.

Lothar
 
Old 12-02-2005, 03:49 AM   #2
Artanicus
Member
 
Registered: Jan 2005
Location: Finland
Distribution: Ubuntu, Debian, Gentoo, Slackware
Posts: 827

Rep: Reputation: 31
You could ofcourse pipe it to stdout, grep the line away and pipe it back to stderr..

Heres an example:
Code:
commands --to --excute 2>&1 | cut -v "member names" 1>&2
I _think_ it should redirect stdout from the first command as normal, so it shouldnt mess up the normal flow of stdout. But, I cannot vouch for that as I havnt used the idea in a situation where stdout output was also needed.

edit:
Actually now tha I come to think of it more, that would probably indeed mess up the normal stdout output to stderr instead.. too bad

Last edited by Artanicus; 12-02-2005 at 03:51 AM.
 
Old 12-02-2005, 03:55 AM   #3
Artanicus
Member
 
Registered: Jan 2005
Location: Finland
Distribution: Ubuntu, Debian, Gentoo, Slackware
Posts: 827

Rep: Reputation: 31
another solution would be to pipe stderr into a file instead of letting it run wild, let a tidy script go over it and mail the rest to you. That way you could add additional filters also.. (:
 
Old 12-02-2005, 04:16 AM   #4
Lotharster
Member
 
Registered: Nov 2005
Posts: 144

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by Artanicus
another solution would be to pipe stderr into a file instead of letting it run wild, let a tidy script go over it and mail the rest to you. That way you could add additional filters also.. (:
How can I mail something to myself via a script?
 
Old 12-02-2005, 08:41 AM   #5
Artanicus
Member
 
Registered: Jan 2005
Location: Finland
Distribution: Ubuntu, Debian, Gentoo, Slackware
Posts: 827

Rep: Reputation: 31
It depends on your setup, e.g. Nail can use the local sendmail for this. Example:
Code:
echo "piip" | nail user
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
/bin/tar: Removing leading `/' from member names guarriman Linux - General 16 02-09-2010 08:19 PM
can't set leading "s" in file permission toddcurry Linux - General 2 10-19-2006 05:34 PM
FC4 install errors, "diabling IRQ #10" "nobody cares" error message??? A6Quattro Fedora 6 07-20-2005 12:49 PM
error message when pressing "Next" "BIOS Problems" , help ! HeRCuLeSX Fedora 3 07-21-2004 02:37 PM
Removing "shutdown" and "reboot" in logout window nearfar Red Hat 1 10-07-2003 11:33 AM


All times are GMT -5. The time now is 03:25 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration