#!/bin/bash #################################### # # Rolling 7 day backup to local directory # #################################### mysqldump_location="path_to_place_mysql_dump_file" /usr/bin/mysqldump --opt your_database_name --single-transaction --default-character-set=utf8mb4 > $mysqldump_location/your_dump_file_name.SQL # What to backup. backup_files="path_to_your_website_directory" # Where to backup to. dest="path_to_place_your_backup_files" # Create archive filename. day=$(date +%A) hostname=$(hostname -s) archive_file="your_domain_name-$day.zip" # Backup the files using zip. zip -r $dest/$archive_file $backup_files rm -f $mysqldump_location/your_dump_file.SQL
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter