<?xml version="1.0"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>Transition Technology: Ticket #472: Quince to Puffin rsync script</title>
    <link>http://localhost:8080/trac/ticket/472</link>
    <description>&lt;p&gt;
Request from Jim:
&lt;/p&gt;
&lt;p&gt;
"can you set up an rsync script on the new box that can:
&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Grab all the files from sites/default/files on the old site recursively
&lt;/li&gt;&lt;li&gt;Exclude the directories 'ctools', 'js', 'css' and 'tmp' folders
&lt;/li&gt;&lt;li&gt;Put them in the /data/disk/[o1 OR tn depending on setup]/static/sites/transitionnetwork.org/files (make the folder)
&lt;/li&gt;&lt;li&gt;Be able to be run any time to bring this up to date, including deleting files that are gone and replacing all changed (except those in the ignored folders)
&lt;/li&gt;&lt;li&gt;Set the permissions and owners afterwards (I'll get the correct values for this afterwards, just leave a space in the script at the end)
&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;
If you can put this in /data/disk/[o1 OR tn depending on setup]/scripts/pull-files-from-quince.sh or similar then that would be awesome. This will allow us to get all the files from the other site whenever and will be useful many times, including when we finally do the go-live."
&lt;/p&gt;
</description>
    <language>en-us</language>
    <image>
      <title>Transition Technology</title>
      <url>/trac/chrome/site/TransitionNetwork-Logo-Web-Small.jpg</url>
      <link>http://localhost:8080/trac/ticket/472</link>
    </image>
    <generator>Trac 0.12.5</generator>
    <item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Tue, 08 Jan 2013 14:35:24 GMT</pubDate>
      <title>hours, status, totalhours changed; resolution set</title>
      <link>http://localhost:8080/trac/ticket/472#comment:1</link>
      <guid isPermaLink="false">http://localhost:8080/trac/ticket/472#comment:1</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;hours&lt;/strong&gt;
                changed from &lt;em&gt;0.0&lt;/em&gt; to &lt;em&gt;1.4&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;status&lt;/strong&gt;
                changed from &lt;em&gt;new&lt;/em&gt; to &lt;em&gt;closed&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;resolution&lt;/strong&gt;
                set to &lt;em&gt;fixed&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;totalhours&lt;/strong&gt;
                changed from &lt;em&gt;0.0&lt;/em&gt; to &lt;em&gt;1.4&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;p&gt;
This script has been created and tested, details follow.
&lt;/p&gt;
&lt;p&gt;
Create a directory for the script and the script:
&lt;/p&gt;
&lt;pre class="wiki"&gt;mkdir /data/disk/tn/scripts
chown tn:users /data/disk/tn/scripts
chmod 700 /data/disk/tn/scripts
touch /data/disk/tn/scripts/pull-files-from-quince.sh
chown tn:users /data/disk/tn/scripts/pull-files-from-quince.sh
chmod 700 /data/disk/tn/scripts/pull-files-from-quince.sh
&lt;/pre&gt;&lt;p&gt;
The directory /data/disk/tn/static currently has one file in it, EMPTY.txt with the content "empty" -- Jim should we delete this file when we create the /data/disk/tn/static/sites/transitionnetwork.org/files directory?
&lt;/p&gt;
&lt;p&gt;
For the moment I have set the script up so that it writes the files into /tmp/ but of course this can be changed by editing the DEST_DIR variable.
&lt;/p&gt;
&lt;p&gt;
Since there is 2.4G of files in /web/transitionnetwork.org/www/sites/default/files on quince I'd suggest moving the contents of /tmp/transitionnetwork.org/files to the place it's wanted to save time / resources compared with rsyncing the data from scratch.
&lt;/p&gt;
&lt;p&gt;
Following is the content of the script:
&lt;/p&gt;
&lt;pre class="wiki"&gt;#!/bin/bash
# See https://trac.transitionnetwork.org/trac/ticket/472
# The server we are copying the files from, see ~/.ssh/config
SOURCE_SERVER="quince"
# Directory on the source server where the files are
# no / at the end please
SOURCE_DIR="/web/transitionnetwork.org/www/sites/default/files"
# The place we want the files copied to
# no / at the end please
DEST_DIR="/tmp/transitionnetwork.org/files"
# The things we want to exclude
EXCLUDE="--exclude=ctools --exclude=js --exclude=css --exclude=tmp"
# The rsync command
RSYNC="rsync -aq --delete"
# Group and user owner to set on transfered files
CHOWN="tn:users"
# Directory permissions to set
CHMOD_DIR="755"
# File permissions to set
CHMOD_FILE="644"
# Check that the $DEST_DIR exists and if it doesn't then create it
if [[ ! -d "$DEST_DIR" ]]; then
  mkdir -p $DEST_DIR
fi
# The rsync command
echo "rsyncing from $SOURCE_SERVER:$SOURCE_DIR/ to $DEST_DIR/ excluding $EXCLUDE"
$RSYNC $EXCLUDE $SOURCE_SERVER:$SOURCE_DIR/ $DEST_DIR/
# The chown command
echo "chowning $DEST_DIR to $CHOWN"
chown -R $CHOWN $DEST_DIR
#  The chmod commands
cd $DEST_DIR
echo "chmodding directories in $DEST_DIR to $CHMOD_DIR"
find -type d -exec chmod $CHMOD_DIR {} \;
echo "chmodding files in $DEST_DIR to $CHMOD_FILE"
find -type f -exec chmod $CHMOD_FILE {} \;
&lt;/pre&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>jim</dc:creator>

      <pubDate>Sun, 20 Jan 2013 18:35:44 GMT</pubDate>
      <title>hours, totalhours changed</title>
      <link>http://localhost:8080/trac/ticket/472#comment:2</link>
      <guid isPermaLink="false">http://localhost:8080/trac/ticket/472#comment:2</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;hours&lt;/strong&gt;
                changed from &lt;em&gt;0.0&lt;/em&gt; to &lt;em&gt;0.25&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;totalhours&lt;/strong&gt;
                changed from &lt;em&gt;1.4&lt;/em&gt; to &lt;em&gt;1.65&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;p&gt;
Thanks Chris.
&lt;/p&gt;
&lt;p&gt;
FYI a couple of tweaks:
&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;DEST_DIR now is "/data/disk/tn/static/sites/transitionnetwork.org-PROD/files".
&lt;/li&gt;&lt;li&gt;RSYNC="rsync -az --delete" (use compression, don't be quiet [I like to see things happen!])
&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;
For some reason it still said nothing while it worked, but it did work! Thanks again.
&lt;/p&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Sun, 20 Jan 2013 18:50:15 GMT</pubDate>
      <title></title>
      <link>http://localhost:8080/trac/ticket/472#comment:3</link>
      <guid isPermaLink="false">http://localhost:8080/trac/ticket/472#comment:3</guid>
      <description>
        &lt;p&gt;
Replying to &lt;a href="http://localhost:8080/trac/ticket/472#comment:2" title="Comment 2 for Ticket #472"&gt;jim&lt;/a&gt;:
&lt;/p&gt;
&lt;blockquote class="citation"&gt;
&lt;ul&gt;&lt;li&gt;RSYNC="rsync -az --delete" (use compression, don't be quiet [I like to see things happen!])
&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;
For some reason it still said nothing while it worked, but it did work!
&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;
To see the output you need -va (v for verbose), compression isn't going to speed things up as both virtual servers are on the same switch, glad it worked :-)
&lt;/p&gt;
      </description>
      <category>Ticket</category>
    </item>
 </channel>
</rss>