suppress tar warning

suppress "tar: Removing leading `/' from member names" warning
This commit is contained in:
Lutz Reinhardt 2018-05-09 09:11:40 +02:00 committed by GitHub
parent 7faed507cf
commit aa8f6aadd5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -40,7 +40,14 @@ function backup_dir_create () {
function backup_files () { function backup_files () {
echo "creating file backup..." echo "creating file backup..."
tar -czf ${BACKUP_DIR}/${TIMESTAMP}_zammad_files.tar.gz ${ZAMMAD_DIR} SRC="${ZAMMAD_DIR}"
ARGS=""
# remove leading "/" to suppress the tar warning
if [[ "${ZAMMAD_DIR}" =~ ^/ ]]; then
SRC="${ZAMMAD_DIR:1}"
ARGS="-C /"
fi
tar ${ARGS} -czf ${BACKUP_DIR}/${TIMESTAMP}_zammad_files.tar.gz ${SRC}
ln -sfn ${BACKUP_DIR}/${TIMESTAMP}_zammad_files.tar.gz ${BACKUP_DIR}/latest_zammad_files.tar.gz ln -sfn ${BACKUP_DIR}/${TIMESTAMP}_zammad_files.tar.gz ${BACKUP_DIR}/latest_zammad_files.tar.gz
} }