如何解决 AIX tar 命令套接字错误?
在 AIX 环境中工作时,我发出以下 tar 命令并在套接字上接收错误。
问题1. 如何避免套接字错误?
问题 2. 我可以依赖 tar 文件来包含除错误文件之外的所有文件吗?
$ 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
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
tar
自动执行此操作。 这使得恢复到/xyz
可能已经存在并且可能不应该被篡改的其他计算机上变得困难。-X
来排除文件; 如果您可以列出要排除的文件,那么它就会起作用。它还有用于处理特殊文件的选项
-d
。光盘 /
查找 xyz -type s -print > /tmp/xx
tar -cvf /tmp/post_patches.tar -X /tmp/xx
rm -f /tmp/xx
这确保所有套接字文件都列在 /tmp/xx 中; 它们将通过 -X 选项从备份中排除。
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.-X
to exclude files; if you can list the files to be excluded, it will work.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.