Login | Register RSS

Questions

All Questions
Apache [2]
Automotive [1]
Contracting [1]
Electronics [1]
Gardening [1]
Home [3]
Linux [20]
Miscellaneous [2]
MySQL [2]
Perl [1]
Tea [1]
WiFi [1]
Windows [1]

Linux 
Ignore sockets during tar backup
Posted on 09/20/2014

If you want to skip error sockets-related code during backup of whole filesystem you will be surprised there's no –ignore-sockets switch.
But there's elegant method to to that:

cd /
sudo find . -type s > /tmp/sockets.lst
if sudo tar zcvpf $TMP_FILE --one-file-system --exclude-from=/tmp/sockets.lst -C / .
then
echo backup OK
fi

or how to get rid of tar’s “socket ignored” message

This based on a very useful tip in Darren Patterson’s blog, something I was looking for for quite a while:

When you want to filter out useless error from stderr messages, while keeping your stdout channel unaffected
(e.g., to get rid of the annoying 'socket ignored' warnings issued by old version of GNU tar), bash is your friend:

        tar  <my_options> 2> >(grep -v 'socket ignored' >&2)
If you like this site or any of its content, please help promote it. Use the social media buttons below to help spread the word. Don't forget to post in the comments section.

  Print   Email
Latest Blog Posts:
Latest Pages:

© 2017 BuildDesignCreate.com • All Rights Reserved
Privacy PolicyAdvertise with UsContact UsSite Map