Posted June 3, 201510 yr I created this little docker to keep a backup of my SQL database for Kodi. It starts from a phusion base image, installs mariaDB and then launches a cron job. It requires a location for the backed-up files, cron parameters, IP address of the SQL server, the pushbullet token if you want notifications and the number of backup files to keep. All of these are environment variables and can be input after selecting Advanced view. I'm using it for some time now with no issues. Link to the docker-template is in my signature. EDIT 1: Right now only one backup a day is supported due to the naming convention of the backup file. But then I was not expecting to need more than one backup a day. EDIT 2: Obviously this docker needs more error proofing - I would like to change it into beta until all the fixes are in place EDIT 3: Added variable for userid, implementing the password is giving me a little headache. Pushbullet notification modified for successful backup and to show error code if the backup command failed. EDIT4: In order to restore a backed-up file use: gunzip < MyDatabase_DATE.sql.gz | mysql -uroot -h 192.168.99.99
June 3, 201510 yr I love the idea of this, I set it up like this, my MySQL server is Needo's MariaDB MySQLIP: 192.168.1.1 (also tried 192.168.1.1:3306) The job runs but creates a 1kb file. The logs don't reveal anything and the pushbullet notification suggests the backup is completed, I suspect it's because of a username / password issue as I don't see anywhere to input this. Also, I think it would be helpful for people like me that aren't particularly skilled with mysql to let us know how to restore the data.
June 3, 201510 yr Author Agreed the userid and password fields need to be available for input. Will update
June 3, 201510 yr Agreed the userid and password fields need to be available for input. Will update Look forward to it, now how would I go about reimporting the sql files into my MariaDB container?
June 25, 201510 yr EDIT 3: implementing the password is giving me a little headache. Any progress on this?
June 25, 201510 yr i m not sure how much a docker repo eats resource but i dont think that mysql backup needs a docker repo. plugin sounds more efficiant to me. i edit my v5 plugin files a bit to backup my kodi database on mariadb docker and add pushover notification. i dont have time for updating my plugin to v6 but i will attach my files, soana or anyone can use or develop. - extract files to /boot/custom/ - change the parametrs in cfg file. - add /backup path mapping to your (mysql/mariadb etc)docker repo. - and add this to your go file: #mysql backup cron job /boot/custom/mysql_cron.sh * checking files permissions will be good to be sure they can be executed. mysql.zip
June 26, 201510 yr Author I agree that a plugin makes more sense since it will also give the option/interface for restoring a backup. The docker created will do regular backups but for restoring one has to use a command line.
June 29, 201510 yr For some reason docker exec -ti command throws a tty error when running from cron. I remove -ti parameter, seems running ok now. mysql.zip
October 15, 20159 yr I am getting the 1kb file also. I saw where to enter the SQL_userid variable to which I entered 'root'. What about the root password and/or db user and password? Where how do I enter those? Would love to get this working. For years I used a script via cronjob to backup my Kodi db's, but now that I switched over to Docker containers I haven't been able to get anything to work. Also, when working correctly, is this just the video database or does it also include the music database?
October 18, 20159 yr I can verify that the missing password is the problem. I took took the command from your cronjob and added -p<apssword> and it ran as exepected from shell. I would fix it, but I have no idea how to use github or how to make my own files to create a Docker container for unraid.
October 19, 20159 yr A password variable is now included in the latest version and it works great. Thanks soana!
October 19, 20159 yr You can use my scripts 3 posts up, no docker needed. I didn't realize what your attachment was. Thanks for the heads up.
April 26, 20205 yr Back from the dead. Does this docker (or the script mentioned) work on 6.8.3? With the docker, I am getting the 1kb file with a zero-byte sql dump file inside. With the script, it fails to run,giving me "mysqldump: errno 11 on write" when it executes the docker command
April 27, 20205 yr Author I did abandon this container some time ago since I did not need it anymore. It was used to backup my xbmc sql database but since I switched to plex I never used it again. I will ask squid to remove it from the list.
Archived
This topic is now archived and is closed to further replies.