LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-14-2011, 07:26 AM   #1
Thaidog
Member
 
Registered: Sep 2002
Location: Hilton Head, SC
Distribution: Gentoo
Posts: 637

Rep: Reputation: 32
Question Need help understanding where this rsync script gets it's data


I've been given an old rsync script to update some data files on a few different servers... I am trying to understand what directory on the server it gets it's files as the way it seems to refer to the data on the server is:

data_source='random-server.fqdominan.net::Firstlogic'

Not sure what the "::Firstlogic" part with the two :: means. Here is the entire script:

Code:
 #!/bin/sh

# Begin user-configurable options #
###################################
# Who can run this script
authorized_user='appdtools'
# From where we rsync the update data
data_source='random-server.fqdominan.net::Firstlogic'
# From where we rsync the rollback data
rollback_data_source='random-server.fqdominan.net::Firstlogic_rollback'
# Where updates will go
data_target='/Firstlogic/postware/dirs'
# How to do the rsync
/usr/bin/tty > /dev/null
if [ $? -eq 1 ]; then
  rsync_args='-av --partial --delete --stats'
else
  rsync_args='-avP --delete --stats'
fi
# These logs will be cleaned before restart
standardizer_logs='/Firstlogic/log/*.log'
# Command to stop the address standardizer
stop_address_command="${HOME}/tools/irwaddress stop"
# Command to start the address standardizer
start_address_command="${HOME}/tools/irwaddress start"
###################################
# End user-configurable options   #
###################################
rsync_test=''

PATH=/bin:/usr/bin; export PATH

case ${1} in

  update )
    action='UPDATE'
   ;;

  rollback )
    do_rollback=true
    action='ROLL BACK'
    data_source=${rollback_data_source}
  ;;

  test )
    rsync_test='-n'
    action='TEST'
  ;;

  * )
    echo "usage: update_firstlogic [update|rollback|test]"
    echo "       Update the Firstlogic data files."
    echo "       With argument 'update', update with new data."
    echo "       With argument 'rollback', roll back to previous data."
    echo "       With argument 'test', do an update dry run"
    echo "       without transferring any files."
    exit 1 
  ;;

esac

splash() {
 if [ `id -nu` != "${authorized_user}" ]; then
   echo "ERROR: You must be user ${authorized_user} to run this script." >&2
   exit 1
 fi

 cat <<END_OF_SPLASH

  WARNING -- WARNING -- WARNING -- WARNING -- WARNING -- WARNING

    You are about to ${action} the Firstlogic address data

    in ${data_target}.

    If this is not what you want to do, press ^C now!

  WARNING -- WARNING -- WARNING -- WARNING -- WARNING -- WARNING

END_OF_SPLASH
  sleep 10
  echo "Continuing"
}

stop_address() {	# Stop the address standardizer
  ${stop_address_command}
  if [ $? -gt 0 ]; then
    echo "ERROR: Failed to stop the address standardizer" >&2
    echo "       Bailing out now" >&2
    exit 1
  fi
}

start_address() {	# Start the address standardizer
  ${start_address_command}
  if [ $? -gt 0 ]; then
    echo "ERROR: Failed to start the address standardizer" >&2
    echo "       Bailing out now" >&2
    exit 2
  fi
}

update_address_data() {	# Update the address data
  echo "NOTICE: Beginning ${action} of Firstlogic data in ${data_target}."
  rsync ${rsync_test} ${rsync_args} ${data_source} ${data_target}
  rc=$?
  if [ ${rc} -eq 0 ]; then
    echo "Success"
  else
    echo "ERROR: rsync failed with return code ${rc}."
    exit ${rc}
  fi
}

clean_logs() {	# Nullify existing log files
  for log_file in ${standardizer_logs}
  do
    echo "NOTICE: Cleaning log file ${log_file}"
    cat /dev/null > ${log_file}
    rc=$?
    if [ ${rc} -eq 0 ]; then
      echo "Success"
    else
      echo "ERROR: cat failed with return code ${rc}."
    fi
    done
}

################################################################################
# Here is where we do the "work".
################################################################################
splash			# Check user and print warning
if [ "${rsync_test}" == "-n" ]; then
  update_address_data	# Test the monthly update
else
  stop_address		# Stop the address standardizer
  update_address_data	# Load the monthly update
  clean_logs		# Empty the old log files
  start_address		# Start the address standardizer
fi
I have not tested this script yet but evidentially it used to work... I just need to find out where to stick the files on random-server.fqdomain.net to test it out. The server it points to no longer has the files on them...
 
Old 04-14-2011, 08:03 AM   #2
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Rep: Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615
:: means it's contacting an rsync daemon, rather than logging in over SSH. Firstlogic is the name of the rsync dameon's share on the server, defined in /etc/rsyncd.conf.
 
Old 04-14-2011, 09:17 AM   #3
Thaidog
Member
 
Registered: Sep 2002
Location: Hilton Head, SC
Distribution: Gentoo
Posts: 637

Original Poster
Rep: Reputation: 32
Quote:
Originally Posted by AlucardZero View Post
:: means it's contacting an rsync daemon, rather than logging in over SSH. Firstlogic is the name of the rsync dameon's share on the server, defined in /etc/rsyncd.conf.
Ok thanks! I cannot locate rsyncd.conf on the old system so it must have been removed.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Data center brief understanding... g_paschoal General 1 03-09-2011 06:10 PM
[SOLVED] Moving install to new hard drive (Fc12) Understanding mount, grub.conf, and rsync thezerodragon Linux - Newbie 5 06-05-2010 11:23 AM
Reading and understanding data send to USB device Dahoon Linux - Hardware 1 06-15-2009 11:11 PM
Understanding sysstat disk i/o data kna829 Linux - General 0 01-10-2008 10:20 AM
LXer: Understanding JFace Data Binding in Eclipse LXer Syndicated Linux News 0 10-06-2006 08:54 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:25 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration