#!/bin/bash
BACKUP_DIR="/mnt/backup-office"
FILES_DIR="/home/user/office/"
FILES_NAMEOP="/home/user/office/01."
FILES_NAMEBUH="/home/user/office/02."
FILES_NAMEDOG="/home/user/office/03."
FILES_NAMESH="/home/user/office/04.""
TIMESTAMP=`date +"%Y-%m-%d_%H-%M-%S"`
BACKUP_NAME=backup-all-$TIMESTAMP.tar.gz
BACKUP_NAMEOP=backup-sales_department-$TIMESTAMP.tar.gz
BACKUP_NAMEBUH=backup-accounting-$TIMESTAMP.tar.gz
BACKUP_NAMEDOG=backup-contract-$TIMESTAMP.tar.gz
BACKUP_NAMESH=backup-accounts-$TIMESTAMP.tar.gz
mount $BACKUP_DIR
mkdir $BACKUP_DIR/$TIMESTAMP
tar czvf $BACKUP_DIR/$TIMESTAMP/$BACKUP_NAME $FILES_DIR
tar czvf $BACKUP_DIR/$TIMESTAMP/$BACKUP_NAMEOP $FILES_NAMEOP
tar czvf $BACKUP_DIR/$TIMESTAMP/$BACKUP_NAMEBUH $FILES_NAMEBUH
tar czvf $BACKUP_DIR/$TIMESTAMP/$BACKUP_NAMEDOG $FILES_NAMEDOG
tar czvf $BACKUP_DIR/$TIMESTAMP/$BACKUP_NAMESH $FILES_NAMESH
umount $BACKUP_DIR
exit 0;
root@websrv01:~# ./backup-office.sh
tar: Removing leading `/' from member names
/home/user/office/
/home/user/office/03. \320\224\320\276\320\263\320\276\320\262\320\276\321\200/
/home/user/office/01. \320\236\321\202\320\264\320\265\320\273 \320\277\321\200\320\276\320\264\320\260\320\266/
/home/user/office/02. \320\221\321\203\321\205\320\263\320\260\320\273\321\202\320\265\321\200\320\270\321\217/
/home/user/office/04. \320\241\321\207\320\265\321\202\320\260/
tar: Removing leading `/' from member names
tar: /home/user/office/01.: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors
tar: Removing leading `/' from member names
tar: /home/user/office/02.: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors
tar: Removing leading `/' from member names
tar: /home/user/office/03.: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors
tar: Removing leading `/' from member names
tar: /home/user/office/04.: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors