[英]How to add tar command to backup script
I am trying to add a tar command to the /test/backup/backup.sh that creates a full backup of everything in my file system except the /text directory to a file called /test/backup.dat.我正在尝试向 /test/backup/backup.sh 添加一个 tar 命令,该命令将我的文件系统中除 /text 目录之外的所有内容创建完整备份到名为 /test/backup.dat 的文件中。 Plus redirect the standard output from this command to a file called /test/backuplog.txt.
加上这个命令的标准输出重定向到一个名为 /test/backuplog.txt 的文件。 Redirect the standard error from this command to a file called /test/errlog.txt.
将此命令中的标准错误重定向到名为 /test/errlog.txt 的文件。 How would I get this done?
我将如何完成这项工作? Thank you.
谢谢你。
You can do that by adding this at the end of each command您可以通过在每个命令的末尾添加它来做到这一点
<command> >>/test/backuplog.txt 2>>/test/errlog.txt
also you need to make sure that /test/backuplog.txt
and /test/errlog.txt
is writable您还需要确保
/test/backuplog.txt
和/test/errlog.txt
是可写的
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.