免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 3575 | 回复: 11
打印 上一主题 下一主题

关于cpio备份的问题!!!!着急。。。。。 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-12-14 09:22 |只看该作者 |倒序浏览
在目录/xxx下。有很多目录如/usr1 /usr2 /usr3................在每一个/usr的确目录下都一个同名的目录/yyy.原来编写的脚本是自动备份目录/xxx的。现在只想备份每个/usr下的/yyy目录。。请问如何写命令。。。。。求救各位大侠。。。。。。在线等。。

论坛徽章:
0
2 [报告]
发表于 2005-12-14 10:48 |只看该作者
有多少个usr 写多少个cpio?? 我也是菜鸟 对这个问题也比较好奇 期待有人来解答下

论坛徽章:
0
3 [报告]
发表于 2005-12-14 11:10 |只看该作者
find /xxx -name \'usr*\' -print | cpio -ov > tape device\r\n\r\nok了  这个应该是成功的 我试过了\n\n[ 本帖最后由 nevertell 于 2005-12-14 11:21 编辑 ]

论坛徽章:
0
4 [报告]
发表于 2005-12-14 12:13 |只看该作者
find /xxx -name \'usr*\' -depth -print | cpio -ov > tape device\r\n\r\n\r\n#man find\r\n......\r\n-depth\r\n      Always true; causes descent of the directory hierarchy\r\n      to  be  done  so  that  all entries in a directory are\r\n      acted on before the directory itself.\r\n       This can be useful when find is used with cpio(1)  to\r\n      transfer  files  that  are  contained  in  directories\r\n      without write permission.

论坛徽章:
0
5 [报告]
发表于 2005-12-14 12:59 |只看该作者

回复 4楼 suisuiyouyu 的帖子

#!/bin/sh\r\necho \"rewind\"\r\n/usr/bin/mt -f /dev/rmt/0 rewind\r\necho \"this is enter directory\"\r\n\r\ncd /xxx\r\necho \"starting backup\"\r\n/usr/bin/find. -print | cpio -ovcB > /dev/rmt/0n\r\n\r\n原来程序是这么写。。。麻烦上面两位大哥看一下该怎么改。。。。不胜感激!!!

论坛徽章:
0
6 [报告]
发表于 2005-12-14 13:06 |只看该作者

回复 4楼 suisuiyouyu 的帖子

find /xxx -name \'usr*\' -depth -print | cpio -ov > tape device\r\n请问。这么写是不是会把所有/usr的目录都备份了啊。。。可每个/usr下还是有好多没用的目录的。我现在只想备份每个/usr下的一个叫/yyy的目录啊。。。。。。。。

论坛徽章:
0
7 [报告]
发表于 2005-12-14 14:19 |只看该作者
那就\r\nfind /usr/yyy -depth -print | cpio -ov > tape device

论坛徽章:
0
8 [报告]
发表于 2005-12-14 14:33 |只看该作者

回复 7楼 suisuiyouyu 的帖子

suisuiyouyu大哥。。。。。谢谢您了。\r\n不过您好象还没明白。。在/xxx下是有好多个/usr的。。如/usr1  /usr2  /usr3  /usr4...........\r\n每个/usr下又有好多目录。其中一个叫/yyy的。。每个/uar里都有。现在想备份的是它。。。\r\n怎么办。。。。。。???????????

论坛徽章:
0
9 [报告]
发表于 2005-12-14 14:46 |只看该作者
find /home/test/usr?/yyy -print | cpio -ov > /home/ew\r\n\r\n这样没问题了吧

论坛徽章:
0
10 [报告]
发表于 2005-12-14 15:31 |只看该作者
for i in `ls /usr*`\r\ndo\r\nfind $i/yyy -depth -print | cpio -ov > <tape device>\r\ndone\r\n\r\n可在sh, ksh里直接输入执行, 不需要写在文件里
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP