Create file
mkdir /usr/serverok/ vi /usr/serverok/backup-daily.sh
Add
#!/bin/bash BACKUP_FILE="backup-`date +%Y-%m-%d`.tgz" /bin/tar --exclude-tag-under=no-backup -zcvhf /backup/$BACKUP_FILE /var/www/html/ aws s3 cp /backup/$BACKUP_FILE s3://S3_BUCKET_NAME/ rm -f /backup/$BACKUP_FILE
Make the file executable
chmod 755 /usr/serverok/backup-daily.sh
Set it run everyday with cronjob
@daily /usr/serverok/backup-daily.sh > /var/log/backup-daily.log 2>&1
To backup MySQL database, use
https://serverok.in/mysqldump-backup
See Backup
Leave a Reply