Last active
December 31, 2015 15:39
-
-
Save alexwitherspoon/8008572 to your computer and use it in GitHub Desktop.
Script made to automatically create a copy of a LAMP style web site/app. Original use case was to regularly refresh a separate copy of a production instance of LAMP to test updates/upgrades etc. This is meant to be lightweight and should work on typical hosting accounts like bluehost/godaddy etc. Copy script to host, enable execution, set the pa…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Alex Witherspoon | |
# LAMP Copy Shell Script | |
# Description: | |
# Script made to automatically create a copy of a LAMP style web site/app. | |
# Original use case was to regularly refresh a separate copy of a production | |
# instance of LAMP to test updates/upgrades etc. This is meant to be lightweight | |
# and should work on typical hosting accounts like bluehost/godaddy etc. | |
# Copy script to host, enable execution, set the paths to the correct | |
# SOURCE and DESTINATION locations, and then schedule VIA cron at the interval | |
# you wish. | |
## ## ## ## ## ## CONFIGURE SETTINGS ## ## ## ## ## ## | |
# Set your full SOURCE path for files on your host (the version to be copied) | |
SOURCE_FILES="/foo/bar/SOURCEFOLDER" | |
# Set your full DESTINATION path for files (the version to be overwritten and updated) | |
DESTINATION_FILES="/foo/bar/DESTINIATIONFOLDER" | |
# TODO - Might not need this if it can be parsed from the config file. | |
# Set your SOURCE database instance (mySQL currently) | |
SOURCE_DB="DBINSTANCE" | |
# Set your DESTINATION database instance | |
DESTINATION_DB="DBINSTANCE" | |
## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## | |
# TODO Check to see if SOURCE_FILES exist | |
if [ -d $SOURCE_FILES ] | |
then | |
echo "SOURCE_FILES looks like a valid source directory" | |
# TODO Check to see if config file exists | |
# TODO Create backup of site files from SOURCE to DEST | |
# TODO Create backup of SQL DB | |
# TODO Change Copy Config File to Reflect new File Location and SQL DB Table | |
# TODO Report Success && Diff updates for Backup | |
else | |
echo $SOURCE_FILES "is not a valid directory" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment