Auto suggest for lot number in the immunization form
[openemr.git] / contrib / util / backup_oemr.sh
blobabb68e979857c2424d65ed06b098891989dd7447
1 #!/bin/bash
2 # backups an openemr system and burns a cd
4 #vars
6 db='openemr'
7 dbuser='backuper'
8 dbpass='bakuper'
9 pguser='sql-ledger'
10 workdir='/var/tmp/backups/'
11 tempdir='/var/tmp/isos/'
12 installdir='/var/www/openemr'
13 newerthan='2005-01-01'
14 #newerthan is a workaround for when your media gets full,
15 #re-edit this file and change the date to the last succesfull cd copy
17 # a name for the file that is unique of that day
18 file=`date +%F`
20 #get the content from the mysql database
21 mysqldump -u ${dbuser} -p${dbpass} --databases ${db} > ${workdir}${file}.sql.bak
23 # compress the file
24 bzip2 ${workdir}${file}.sql.bak
26 #get the content from the postgres database
27 pg_dumpall -U ${pguser} > ${workdir}${file}postgres.bak
29 # compress the file
30 bzip2 ${workdir}${file}postgres.bak
32 # get all the files on the site
33 # we are using bzip2 here
34 tar -N ${newerthan} -jcf ${workdir}${file}openemr.tar.bzip2 ${installdir}
36 # create a disk image
37 label=`date +%y%m%d`
38 mkisofs -J -R -V ${label} -o ${tempdir}image.iso ${workdir}
40 #burn it
41 cdrecord -dao -v -data -eject ${tempdir}image.iso
43 #delete the original files
44 rm -rf ${workdir}*
46 exit 0