Skip to content

Instantly share code, notes, and snippets.

@bradymiller
Last active May 25, 2020 08:49
Show Gist options
  • Save bradymiller/478814 to your computer and use it in GitHub Desktop.
Save bradymiller/478814 to your computer and use it in GitHub Desktop.
Ubuntu script to prepare a github repository for testing the OpenEMR Development tip
#!/bin/bash
#
# Copyright (C) 2014 Brady Miller <[email protected]>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# Ubuntu script to prepare a github repository for testing. This is
# specifically to allow quick testing of new code, and is not for
# production use.
#
# This script will copy the current checked git repository into
# the web directory (and remove the currently installed openemr).
# Place this script in the git directory (one level above the openemr
# directory).
# Note you need to install openemr with the mysql user 'openemr' and
# the mysql database 'openemr' for this script to completely remove
# OpenEMR.
# Also note the root mysql password needs to be blank for the mysql
# and mysqladmin commands to work.
#
# This script can also be used on your cvs checkout if you place it in
# the cvs directory (one directory above openemr)
#
# Remove current test copy of openemr
sudo rm -fr /var/www/openemr
# Remove current openemr mysql database
sudo mysqladmin -f -h localhost -u root --password="hey" drop openemr
# Remove current openemr mysql user
sudo mysql -f -u root --password="hey" -h localhost -e "Drop user 'openemr'@'localhost';FLUSH PRIVILEGES;"
# Copy the new openemr version to the web directory (note need to ignore the .git directory)
rsync --recursive --links --exclude .git openemr /var/www
# modify permissions
sudo chmod 666 /var/www/openemr/sites/default/sqlconf.php
sudo chown -R www-data:www-data /var/www/openemr/sites/default/documents
# Restart the mysql server
sudo service mysql restart
# Copy the apache conf script, turn it on, and restart the apache server (uncomment below if have apache openemr.conf file and want to test)
# sudo cp openemr.conf /etc/apache2/sites-available/
# sudo a2ensite openemr.conf
# sudo service apache2 restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment