Answer the question
In order to leave comments, you need to log in
Error in backup script?
#!/bin/bash
FILES_DIR="/var/www"
BACKUP_DIR="/mnt/backup"
TIMESTAMP='data +"%Y-%m-%d_%H-%M-%S"'
mount $BACKUP_DIR
mysqldump -uroot -hlocalhost -pSuper2021 --all-databases > $BACKUP_DIR/$TIMESTAMP.sql
tar -czvf $BACKUP_DIR/$TIMESTAMP.tar.gz $FILES_DIR/
umount $BACKUP_DIR
exit 0;
Answer the question
In order to leave comments, you need to log in
TIMESTAMP='data +"%Y-%m-%d_%H-%M-%S"'
Your quotes are wrong here. Single quotes are just text. Backward single quotes are command substitution (what you meant to do)
But it's better to use the $() construct:
TIMESTAMP=$(date +"%Y-%m-%d_%H-%M-%S")
ps and yes, you have data instead of date
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question