Re: keeping tar quiet in script
- To: debian-user@lists.debian.org
- Subject: Re: keeping tar quiet in script
- From: Cédric Lucantis <omer@no-log.org>
- Date: Sun, 1 Apr 2007 12:27:02 +0200
- Message-id: <[🔎] 200704011227.02302.omer@no-log.org>
- In-reply-to: <e628adfd0703311255r18dee682ncc5a52c175ab3ce3@mail.gmail.com>
- References: <6512EE9C-496F-4407-88F2-B9FCF0FEB341@onemanifest.net> <e628adfd0703311255r18dee682ncc5a52c175ab3ce3@mail.gmail.com>
Le samedi 31 mars 2007 21:55, Jorge Peixoto de Morais Neto a écrit :
> > I'm using a simple script for making backups with tar. I can't make tar
> > quiet, so cron keeps mailing me 'Removing leading `/' from member names'
> > . Adding > /dev/null doesn't help. What can I do to catch tar's output
> > and keep it from shouting all over the place?
>
> a "> /dev/null" redirects stdout to /dev/null, but stderr is left
> untouched.
> a "&> /dev/null" redirects both stdout and stderr to /dev/null.
>
redirecting stderr is good but will also discard other possibly helpful error
messages if something goes wrong. You can simply avoid this particular one
with something like this :
tar -cf archive -C/ .
another trick is to redirect the whole script to some log file (or /dev/null
if you're fearless) by putting this at its beggining :
LOGFILE=...
exec > "$LOGFILE" 2>&1
--
Cédric Lucantis
Reply to: