Skip to content

Instantly share code, notes, and snippets.

@bluengreen
Created May 14, 2018 22:01
Show Gist options
  • Select an option

  • Save bluengreen/08eda779967dbb0a1d99cbaecdfcc00a to your computer and use it in GitHub Desktop.

Select an option

Save bluengreen/08eda779967dbb0a1d99cbaecdfcc00a to your computer and use it in GitHub Desktop.
#!/bin/bash
# settings the paths
mirthPath="/opt/mirthconnect/"
backupPath="/home/mirth/backups/"
scriptPath=`pwd`"/"
vDate=`date --date 'yesterday' +%Y-%m-%d`
# generating console command
echo exportcfg ${backupPath}mirth_backup-${vDate}.xml > ${scriptPath}backup_cmds
# run backup
${mirthPath}Mirth\ Connect\ CLI -s ${scriptPath}backup_cmds
# generating checksum
cd ${backupPath}
md5sum mirth_backup-${vDate}.xml > mirth_backup-${vDate}.md5
md5sum mirth_backup-${vDate}.xml >> checksums.md5
# compress backup with 7z
7z a -t7z -mx=9 ${backupPath}mirth_backup-${vDate} ${backupPath}mirth_backup-${vDate}.* && rm ${backupPath}mirth_backup-${vDate}.xml ${backupPath}mirth_backup-${vDate}.md5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment