Paul Walker on 26 Apr 2012 13:34:08 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[PLUG] First shell script for deployment...


This is the first shell script I've written... pretty basic but nice for now since I need to maintain some consistency across installations.. (OT but I'll use .gitignore to avoid having to do this in the future... for now I want to eliminate as much inconsistency as possible).  Any thoughts or constructive criticism appreciated:

<code>
#!/bin/bash

# Run this from the directory **above** the public_html directory for the site you are deploying

#create dir and clone upstream repo
mkdir public_html_deploy1
cd public_html_deploy1
git init
git clone git@foo.com:project/repo.git
git remote add foo git@foo.com:project/repo.git
git config remote.foo.push refs/heads/master:refs/heads/master
mv repo ../public_html_deploy

#move untracked files from current webroot into deployment directory tree
cd ../public_html_deploy
cp -r ../public_html/articleImport .
cp -r ../public_html/themes .
cp -r ../public_html/submissions .
cp -r ../public_html/sites/all/themes/ sites/all/themes
cp ../public_html/sites/default/settings.php sites/default/settings.php
cp -r ../public_html/sites/default/files/ sites/default/files

#get rid of the stepping stone directory
rm -rf ../public_html_deploy_1

#set file permission
chmod -R 777 sites/default/files
</code>
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug