Category Archives: bash
Very simple MySQL backup bash script
This code backups up mysql databases and gzips them into the current working directory. If you want to backup the mysql table, remove it from the for loop. #!/bin/bash usage(){ echo “Usage $0 <mysql_user> <mysql_password>” exit 1 } if [[ … Continue reading
Posted in bash, Commands, Linux, MySQL
Leave a comment
Simple PostgreSQL and data backup script for Linux bash
backup-script.sh #!/bin/bash export PGPASSWORD=SUPERSECRETPASSWORD thedate=`date –rfc-3339=date` echo "Making tarball for $thedate" filename="$thedate.tar.gz" `pg_dump -U postgres the_database > /var/www/db_dump.sql` tar czf /backups/$filename /var/www Above is a simple bash script to backup a directory after making a PostgreSQL data dump. I left … Continue reading
