tags:

views:

820

answers:

2

Working in an AIX environment, I'm issuing the following tar command and receive errors on sockets.

Question 1. How can I avoid the socket errors?

Question 2. Can I rely on the tar file to contain all files excluding the ones in error?

 $ tar  -cvf /post_patches.tar /xyz 
   tar: /xyz/runtime/splSock6511 could not be archived
   tar: /xyz/runtime/splSock6507 could not be archived
   tar: /xyz/runtime/splSock6510 could not be archived
   tar: /xyz/runtime/splSock6506 could not be archived

 $ ls -asl spl*
   0 srwxrwxrwx    1 myuser   myuser            0 Nov 19 09:41 splSock6506
   0 srwxrwxrwx    1 myuser   myuser            0 Nov 19 09:41 splSock6507
   0 srwxrwxrwx    1 myuser   myuser            0 Nov 18 14:19 splSock6510
   0 srwxrwxrwx    1 myuser   myuser            0 Nov 18 14:19 splSock6511
A: 

I don't have AIX at hand to take a look, but the 'tar' on Mac OSX supports the '--ignore-failed-read' switch. Have you taken a look at it?

ayaz
+1  A: 
  1. You should probably avoid including the absolute path - GNU tar does that automatically. It makes it hard to restore onto other machines where the /xyz may already exist and perhaps should not be tampered with.
  2. You probably should not be writing in the root directory - it is a bad practice to get into.
  3. AIX tar has support for option -X to exclude files; if you can list the files to be excluded, it will work.
  4. It also has option -d for dealing with special files.

    cd /

    find xyz -type s -print > /tmp/xx

    tar -cvf /tmp/post_patches.tar -X /tmp/xx

    rm -f /tmp/xx

This ensures that any socket files are listed in /tmp/xx; they will be excluded from the backup by the -X option.

Jonathan Leffler