[Cialug] Backup script, did I miss anything?

Rob Cook rdjcook at gmail.com
Wed Dec 24 16:06:51 CST 2014


No, I'm not compressing the sql dump, I thought about it but it's actually
pretty small so I'm not worried but I suppose I should in case. I didn't
grab anything out of /etc, I'm mostly concerned with the content of the
site and I've not really done much to php.conf other than change the max
ram variable. Really once all that is configured it doesn't change much, I
supposed I could ask for a snapshot of the VM then it really wouldn't
matter as long as I have the site data... Hmmm.

On Wed, Dec 24, 2014 at 3:35 PM, Scott Yates <Scott at yatesframe.com> wrote:

> Is the sqldump being compressed?
> Do you want to grab your php and other assorted config files out of /etc?
>
>
> On Wed, Dec 24, 2014 at 3:23 PM, Rob Cook <rdjcook at gmail.com> wrote:
>
> > I worked up a backup script for a website that I help with, I wanted to
> > have local and offsite backups just in case. I've tested the script and
> > everything works for me now but I just wanted another set of eyes to
> take a
> > look and see if I missed something.
> >
> > Thanks,
> >
> > Rob Cook
> >
> > #!/bin/bash
> > #Define variables belowTIME=`date +%b-%d-%y`                   # This
> > command will add date in backup file name.
> > #WordpressWPFILENAME="websitewphtml"                # This defines the
> > Wordpress backup file name.WPSRCDIR="/var/www/html/"               #
> > Location of Wordpress dataDESDIR="/opt/backup"                    #
> > Destination of all backup files.
> > #MySQLMYSQLUSER="something"                   # MySQL
> > usernameMYSQLPASSWORD="somethingelse"           # MySQL
> > passwordMYSQLHOST="localhost"                   # MySQL
> > hostnameMYSQLDBNAME="yetanotherthing"           # MySQL database name
> >
> >
> #LoggingLOG="/opt/backup/$WPFILENAME-$TIME.log"LOGSQL="/opt/backup/$MYSQLDBNAME-$TIME.log"
> > #Actual backing up of things below
> > tar -cvpzf $DESDIR/$WPFILENAME-$TIME.tar.gz $WPSRCDIR 2>&1 >> $LOG
> > mysqldump -v --user=$MYSQLUSER --password=$MYSQLPASSWORD
> > --host=$MYSQLHOST $MYSQLDBNAME > $DESDIR/$MYSQLDBNAME-$TIME.sql 2>
> > $LOGSQL
> > #Locate backups & logs more than 14 days old and delete them
> > find /opt/backup/websitewphtml-*.tar.gz -maxdepth 1 -type f -mtime +14
> > -delete
> > find /opt/backup/yetanotherthing-*.sql -maxdepth 1 -type f -mtime +14
> > -delete
> > find /opt/backup/*.log -maxdepth 1 -type f -mtime +14 -delete
> > #rsync backups to remote server
> > rsync -avplm --delete --ignore-existing /opt/backup/ -e "ssh -p NOT22"
> > SSHKEY at REMOTEIPADDRESS:/opt/backup/
> > _______________________________________________
> > Cialug mailing list
> > Cialug at cialug.org
> > http://cialug.org/mailman/listinfo/cialug
> >
> _______________________________________________
> Cialug mailing list
> Cialug at cialug.org
> http://cialug.org/mailman/listinfo/cialug
>


More information about the Cialug mailing list