Skip to content

Instantly share code, notes, and snippets.

@jepster
Last active July 28, 2016 18:48
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 jepster/2f05b78d47cd0b954a5191f90562d250 to your computer and use it in GitHub Desktop.
Save jepster/2f05b78d47cd0b954a5191f90562d250 to your computer and use it in GitHub Desktop.
Phing Target for Website Sync
<target name="syncWebsiteToLive"
description="Sync folder and files via Rsync to live server.">
<echo msg="Syncing data to live server." />
<exec command="rsync -a --progress --delete /home/peter/Websites/example.com/ --exclude=.git/ --exclude=.idea/ --exclude=sites/default/settings.php user@example.com:/var/www/example.com/"
passthru="true"
checkreturn="true" />
<echo msg="Delete old database" />
<exec command="ssh example.com 'mysql -uroot -pPASSWORD -e &quot;drop database example_com;&quot;'"
passthru="true"
checkreturn="true" />
<echo msg="Create new empty database" />
<exec command="ssh example.com 'mysql -uroot -pPASSWORD -e &quot;create database example_com;&quot;'"
passthru="true"
checkreturn="true" />
<echo msg="Import database dump" />
<exec command="ssh example.com 'mysql -uroot -pPASSWORD example_com &lt; /var/www/example.com/db_dumps/latest.sql'"
passthru="true"
checkreturn="true" />
</target>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment