tar + split + output
Hello,
I have this command: $TAR -cvf - $SOURCEDIR $EXCLUDEDIR | split --bytes=1999m - $BACKUP_DEVICE 1>/usr/backup/backuped_files.lst this part is working as expected: $TAR -cvf - $SOURCEDIR $EXCLUDEDIR | split --bytes=1999m - $BACKUP_DEVICE this part is not working: 1>/usr/backup/backuped_files.lst My purpose is to catch the backuped files in backuped_files.lst (screen output without errors) Can you help me? Regards, Renaud |
Because of the pipe, the redirect is only catching output of the second command. Put the redirect before the pipe like this:
Code:
$TAR -cvf - $SOURCEDIR $EXCLUDEDIR 1>/usr/backup/backuped_files.lst | split --bytes=1999m - $BACKUP_DEVICE |
thx
i tested it:
redhat #tar cvf - /usr/backup/ --exclude=/usr/backup/logs 1>/usr/backuped_files.lst | split --bytes=1m - /usr/tartestoutput.tar. tar: Removing leading `/' from member names usr/backup/ usr/backup/backup.log usr/backup/testje.sh usr/backup/backuped_files.lst usr/backup/1 usr/backup/backup2.sh usr/backup/backup3.sh usr/backup/çwq! usr/backup/mount_backup.sh usr/backup/umount_backup.sh usr/backup/cpio_to_export_backup.sh usr/backup/backup_functions.sh usr/backup/daily_backup.sh usr/backup/transferred_files_beukdb3.lst usr/backup/online_backup_varlab.sh usr/backup/transferred_files_beukdb4.lst usr/backup/cpio_to_export_backupcold.sh usr/backup/weekly_cold_backup.sh usr/backup/rman_varlab.sh usr/backup/mount_backup.sh.28112007 usr/backup/daily_backup_copy.sh usr/backup/weeklytest.sh usr/backup/backup_functions.sh.28112007 usr/backup/backup_functions.sh.090708 usr/backup/mount_backup_ict.sh usr/backup/umount_backup_ict.sh usr/backup/today1.log redhat# the backuped_files.lst file is 100M and contains logs from 10 july 2015 no tar created tar cvf - /usr/backup/ --exclude=/usr/backup/logs | split --bytes=1m - /usr/tartestoutput.tar. (worked as expected) |
solution
hello,
i found a workaround (not clean but working…): i inserted tags (tar start and tar end)in my log file and i used /bin/sed to extract tar logs from it. extract tar logs from backup.log to backuped_files.lst Code:
sed -n '/^tar start/,/^tar end/p' backup.log > backuped_files.lst Code:
sed '/^tar start/,/^tar end/d' backup.log > backup.log Regards, Renaud |
All times are GMT -5. The time now is 12:35 AM. |