I'm trying to capture all output from a backup script I'm running as a cronjob. I save all of my backups in tar.7z files but for some reason only the output from 7z is being captured while the output from tar is not:
Specific code:
my $backupcommand = "tar -cvf - ".$directory."/".$seasonYear."*.html|7 +z a -mx9 -si ".$backupdirectory."/".$seasonYear.".tar.7z"; my $result = `$backupcommand 2>&1`;
The following is the resulting output in the terminal:
user@server:~$ perl dailyscript.pl > testout.txt tar: Removing leading `/' from member names /home/user/backupdirectory/2011.html user@server:~$
The following is the resulting output in testout.txt:
7-Zip [64] 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18 p7zip Version 9.20 (locale=en_GB.UTF-8,Utf16=on,HugeFiles=on,4 CPUs) Creating archive /home/user/backupdirectory/2011.tar.7z Compressing [Content] Everything is Ok
I also tried the following and got the same result:
my $backupcommand = "tar -cvf - ".$directory."/".$seasonYear."*.html 2 +>&1|7z a -mx9 -si ".$backupdirectory."/".$seasonYear.".tar.7z"; my $result = `$backupcommand 2>&1`;
Any suggestions on how to capture all of it?
In reply to [SOLVED] Issue with capturing STDOUT using tar and p7zip by dblt1234
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |