Sam Gleske on 1 Sep 2013 08:55:19 -0700

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] tar/pigz question

On Fri, Aug 30, 2013 at 11:20 AM, <> wrote:

/bin/tar -c -v --use-compress-program=pigz /mnt/drive_z/ \
         -f  /mnt/backupLUN09_SAN/file-server-backup--`date +%m_%d_%y`--.tar.gz \
         1>  file-server-backup--`date +%m_%d_%y`.index

There's potential for a date discrepancy.  To keep file names consistent you should set the date in a variable first and then call it.  When referencing variables you should use the newer bash format ${var} and when subshelling you should use $(command) rather than `command`.

DATE="$(date +%m_%d-%y)"
/bin/tar -c -v --use-compress-program=pigz /mnt/drive_z/ \
         -f  /mnt/backupLUN09_SAN/file-server-backup--${DATE}--.tar.gz \
         1>  file-server-backup--${DATE}.index

Also, I second Rich's opinion in that you should use a real backup solution rather than jerry rigging it with tar+compression.
Philadelphia Linux Users Group         --
Announcements -
General Discussion  --