Skip to content

Instantly share code, notes, and snippets.

@mrinterweb
Created July 14, 2009 05:38
Show Gist options
  • Save mrinterweb/146734 to your computer and use it in GitHub Desktop.
Save mrinterweb/146734 to your computer and use it in GitHub Desktop.
#!/bin/bash
# This script synchronizes the luminis files on this server with the live luminis server
# remote dir on the luminis server
luminis_dir="/u01/luminis/webapps/luminis/www/CC/"
# The following variables change based on server running this script
this_dir="/var/www/luminis_sync"
local_luminis_files="/var/www/html/cake/app/webroot/files/luminis_base/*"
# derived variables
local_dir="$this_dir/files"
known_hosts="$this_dir/known_hosts"
# used for testing from the command line or as the swipht user
is_apache_user=`whoami`
echo "Running as $is_apache_user user"
if [ $is_apache_user == "apache" ]
then
#user=apache
luminis_key="$this_dir/luminis_id_dsa"
else
#user=swuser
luminis_key="$this_dir/luminis_id_dsa.copy"
fi
# execute the rsync
#/usr/bin/rsync -rzh --stats --rsync-path=/usr/local/bin/rsync --exclude=.svn -e "ssh -i $luminis_key -o UserKnownHostsFile=$known_hosts -o StrictHostKeyChecking=no" $local_luminis_files lmadmin@luminis-server:$luminis_dir
/usr/bin/rsync -rzh --stats --rsync-path=/usr/local/bin/rsync --exclude=.svn -e "ssh -i $luminis_key" $local_luminis_files lmadmin@luminis-server:$luminis_dir
# Set the last commands Result Code
RC=$?
if [ 0 -eq $RC ]
then
echo "The rsync command was successfull"
else
echo "An imminent sense of dread is felt as rsync fails in its task"
fi
# Exit with the result code of rsync
exit $RC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment