Years ago, I installed Piwigo but never used it much. I just removed my old installation and started fresh yesterday. I'm planning to customize my setup a lot... and, if I get it where I want, I'll add thousands of photos. So I need reliable automated backup that runs fairly often while I'm setting things up... to make it easy to go back to a previous setup if I do something wrong. (Later, I'll be protected if something else goes wrong, if I need to revert to a previous Piwigo version, etc.)
Years ago, I did some research into MySQL (which I don't know much about) and found what I thought would be a reliable way to make backups of the database without having it in an inconsistent state. Backing up the filesystem (photos, etc.) is easier because the backup can run in the middle of the night -- when I won't be making changes. I'm running on a Linux system, so I can use the crontab facility to run the backups automatically whenever I want. (For those of you who haven't used a command line interface, you'd want someone else to set this up for you.)
Can one of you MySQL gurus tell me if this (below) is a reliable system? I put the commands into a shell script file; cron runs that file. Here's the gist of it:
bkups=$HOME/backups bzip=/bin/bzip2 tar=/bin/tar date=/bin/date host=jerrypeek_piwigo topdir=$HOME/jerrypeek.com mysqldump=/usr/bin/mysqldump db_host='xyz.com' db_name='db12345' db_pwrd=(I'm not showing how I get the password...) db_user='db98765' ... error checking code not shown ... datetime=`$date '+%Y%m%d_%H%M%S'` tarfile=$bkups/${host}_$datetime.tar.bz2 logfile=$bkups/${host}_$datetime.log ... ... # Make backup. Don't pipe to bzip so it'll finish ASAP: $mysqldump --opt -h "$db_host" -u "$db_user" -p"$db_pwrd" "$db_name" > $bkups/${host}_database_$datetime # Compress backup: $bzip $bkups/${host}_database_$datetime cd $topdir || exit tar --exclude='./tmp' -cjvf $tarfile . > $logfile 2>&1 || echo "tar RETURNED NON-ZERO STATUS" $bzip $logfile
Thanks for any feedback!
Piwigo version: 2.10.1
PHP version: 7.3
MySQL version: 5.7
Piwigo URL: http://jerrypeek.com/gallery/
Offline