Backup all mysql databases

Backup all mysql databases

I created an easy way to backup all mysql databases
/mnt/srv-ttp-nas/ is a location on a local NAS

sleep 10

BACKUP_DIR = "/mnt/srv-ttp-nas/bu/databases"

#find all databasses and backup them
databases=`mysql --user=$DB_USER --password=$DB_PASS -e "SHOW DATABASES;" | tr -d "| " | grep -v Database`

for db in $databases; do
        echo "Dumping database: $db"
        mysqldump $db -u $DB_USER -p --password=$DB_PASS | gzip > "/mnt/srv-ttp-nas/databases/"`date +%Y-%m-%d_%H-%M-%S`-$db.sql.gz

#remove files older than one month
find /mnt/srv-ttp-nas/databases/* -mtime +31 -exec rm {} \;

The power of this script is that if you add a new database this will automaticly be added.

Add to crontab to backup every 6 hours.

sudo crontab -e
0 0,6,12,18 * * * /home/tom/

Preview of data on share

Update Unifi AP using SSH

Update Unifi AP using SSH

Download the correct software from Ubiquiti.

Change the name from the downloaded file to fwupdate.bin

Open WinSCP and connect to the AP using SCP protocol.

Copy the fwupdate.bin file to /tmp folder.

Close WinSCP and open Putty. Connect to the AP using ssh.

Issue the command upgrade2 & after this your session will close automatic and the AP will start the upgrade.