xiaoanri wrote on Wednesday, August 13, 2014:
fsgl, i totally agree my previous back up was not complete with sql data only, and am happy the restore script works for you, not sure why it was not working for me. Kevin also mentioned how to manually backup the documents if a fresh install is done.
the back up cron script was derived from the same link you just updated: http://www.open-emr.org/wiki/index.php/Backing_Up_Using_the_Built_In_Tools#Using_the_Terminal
the cron script is as the following:
0 1 * * * tar -C /var/www/openemr/ -zcf openemr.tar.gz ./
40 1 * * * mysqldump --opt --quote-names -umysqluser -pmysqlpassword openemr | gzip > openemr.sql.gz
20 2 * * * tar -cvf emr_backup.tar openemr.sql.gz openemr.tar.gz
10 3 * * 1 sshpass -p ‘password’ scp emr_backup.tar user@ip-adress:/…/monday
10 3 * * 2 sshpass -p ‘password’ scp emr_backup.tar user@ip-adress:/…/tuesday
10 3 * * 3 sshpass -p ‘password’ scp emr_backup.tar user@ip-adress:/…/wednesday
10 3 * * 4 sshpass -p ‘password’ scp emr_backup.tar user@ip-adress:/…/thursday
10 3 * * 5 sshpass -p ‘password’ scp emr_backup.tar user@ip-adress:/…/friday
10 3 * * 6 sshpass -p ‘password’ scp emr_backup.tar uuser@ip-adress:/…/saturday
10 3 * * 7 sshpass -p ‘password’ scp emr_backup.tar user@ip-adress:/…/sunday
this will generate the 2 backup files at 1am every day and tar the 2 files into one, and put it in a different remote directory on each day of the week, so you get the most recent 7 days of backup any time you want. i do not know how to update the wiki, feel free to post it there should it be of any help. of course, one will need to change the password, user, ip-address, etc accordingly.
i believe this could be written into one shell script and have the cron doing the script, but do not have time to study that yet, as it is, it works well for me. only thing is you would want to have enough time in between each task so that it would have finished the previous one when the next task is scheduled to start. i leave 40min, that is ample time for a small practice like us.