Skip to content

Instantly share code, notes, and snippets.

@fndtn357
Forked from bradymiller/refresh
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fndtn357/d997630988e69a9907a7 to your computer and use it in GitHub Desktop.
Save fndtn357/d997630988e69a9907a7 to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# Copyright (C) 2014 Brady Miller <brady@sparmy.com>
#
# 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 drop openemr
# Remove current openemr mysql user
sudo mysql -f -u root -h localhost -e "DELETE FROM mysql.user WHERE User = 'openemr';FLUSH PRIVILEGES;"
# Copy the new openemr version to the web directory (note need to ignore the .git directory)
sudo rsync --recursive --exclude .git openemr/* /var/www/openemr/
# modify permissions
sudo chmod 666 /var/www/openemr/sites/default/sqlconf.php
sudo chown www-data:www-data /var/www/openemr/interface/modules/zend_modules/config/application.config.php
sudo chown -R www-data:www-data /var/www/openemr/sites/default/documents
sudo chown -R www-data:www-data /var/www/openemr/sites/default/edi
sudo chown -R www-data:www-data /var/www/openemr/sites/default/era
sudo chown -R www-data:www-data /var/www/openemr/library/freeb
sudo chown -R www-data:www-data /var/www/openemr/sites/default/letter_templates
sudo chown -R www-data:www-data /var/www/openemr/interface/main/calendar/modules/PostCalendar/pntemplates/compiled
sudo chown -R www-data:www-data /var/www/openemr/interface/main/calendar/modules/PostCalendar/pntemplates/cache
sudo chown -R www-data:www-data /var/www/openemr/gacl/admin/templates_c
# 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