Hi All,
My server is running a GNU version of tar, and I have a cron job running a shell script to perform a daily backup of a directory with this command:
The shell script itself resides inside /home/tandem/backups/.
Upon executing, tar emits the message:
Since I'm giving tar an absolute path, this is exactly what I want tar to do... I want tar to remove that leading '/' so that my archive path will be a relative path, home/tandem/backups/files.tar.
My concern is this: Other versions of tar I've used in the past don't automatically remove that leading '/' from member names and I want to make sure that if my code moves to another platform with another version of tar, that I never write an archive with that leading '/' in front of the member names... I've done that before and had critical directories under '/' overwritten when the archive was extracted.
So... is there a mostly-universal switch I can provide tar that'll cause any version to remove the leading '/' from member names? If not, how can I specify the relative path, considering that my backups need to begin in the directory just above the directory containing my backup shell script?
Thanks in advance for any tips!
My server is running a GNU version of tar, and I have a cron job running a shell script to perform a daily backup of a directory with this command:
Code:
/bin/tar cvfz /home/tandem/backups/files.tar /home/tandem/
The shell script itself resides inside /home/tandem/backups/.
Upon executing, tar emits the message:
Code:
/bin/tar: Removing leading `/' from member names
Since I'm giving tar an absolute path, this is exactly what I want tar to do... I want tar to remove that leading '/' so that my archive path will be a relative path, home/tandem/backups/files.tar.
My concern is this: Other versions of tar I've used in the past don't automatically remove that leading '/' from member names and I want to make sure that if my code moves to another platform with another version of tar, that I never write an archive with that leading '/' in front of the member names... I've done that before and had critical directories under '/' overwritten when the archive was extracted.
So... is there a mostly-universal switch I can provide tar that'll cause any version to remove the leading '/' from member names? If not, how can I specify the relative path, considering that my backups need to begin in the directory just above the directory containing my backup shell script?
Thanks in advance for any tips!