LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-23-2009, 06:39 PM   #1
Arty Ziff
Member
 
Registered: May 2008
Location: Tacoma, WA
Distribution: CentOS and RHEL
Posts: 102

Rep: Reputation: 15
Move file from machine A to B on same network?


I have two servers on my network (at home). Let's call them A and B.

I have a small shell script that I have written on server A that zips up a file, backs up a database. It's triggered by cron once a day.

After I run it, I would like to move this file from server A to server B.

As I said, both are on the same network (in the same room, actually), and so obviously have different network IPs.

What are my options to move these files? It would need to be something that was done in perhaps a shell script that was, like the shell script that zips the files, is triggered by a cron job.

I'm assuming there are actual applications for this sort of theng (rsync?), but can it be done with a shell script? It seems very simple and basic...

How might this be done?

Systems:

Server A - CentOS v. 5

Server B - RHEL v. 4
 
Old 11-23-2009, 06:46 PM   #2
landysaccount
Member
 
Registered: Sep 2008
Location: Dominican Republic
Distribution: Debian
Posts: 188

Rep: Reputation: 18
I'm currently backing up my server as well with a small script that would copy the tar file to the other.

Here's the script:


# created date: November 09, 2009
# description: This script will backup files
# update:
######################################################################

REMOTE_SERVER="172.16.0.3:/backup/"

BASE_DIR="/home/backup/"
SQL_FILE="mysqlfile.sql"

DATE=$(date +"%b-%d-%Y")

TAR_FILE="BackUp-$DATE.tar.gz"
MSD_DIR="/etc/msd"
DHCP="/etc/dhcp3/dhcpd.conf"
NOCAT="/usr/local/nocat"
SQUID="/etc/squid/squid.conf"
OPTIMUM="/home/landysaccount/optimum"
WWW="/var/www"

# back up mysql database
mysqldump optimum > "$BASE_DIR$SQL_FILE"


# create tar file backup
tar czf $TAR_FILE "$BASE_DIR$SQL_FILE" $DHCP $MSD_DIR $SQUID $OPTIMUM $WWW

# send to backup server
scp $TAR_FILE landysaccount@$REMOTE_SERVER

exit 0

#########################
Make sure you can login to the other server/machine without having to type a password.

Hope that helps.
 
Old 11-23-2009, 08:01 PM   #3
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,063

Rep: Reputation: 381Reputation: 381Reputation: 381Reputation: 381
There are indeed many ways. The big picture is this: you can choose to mount the remote volume, then just move or copy the file as you would copy it to another disk, using cp, mv, whatever. This can be done with nfs, sshfs, samba...

You can also choose to use a server-client model. In this case, you need to run a server in one of your machines, and launch the client in the other machine to literally upload your file to the server. This can be done usually with ssh (scp), ftp, rsync, and many other ways.

Both ways have advantages I guess, and often the line is thin. For example, if you have an ssh server running in your central machine, you can upload files to it by using either the scp file transfer tool, or by mounting the remote volume with sshfs and the using cp or mv to put the files inside the mounted share.

Last edited by i92guboj; 11-23-2009 at 08:13 PM. Reason: typo
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
File system corrupted, how to move LVM drives to another machine to recover files? Arodef Linux - Hardware 1 08-07-2009 07:19 PM
Is it OK to move an installation from one machine to another? naxos2 Debian 6 04-24-2007 09:48 AM
Move image to another machine patrick2099 Linux - General 5 12-07-2006 12:26 PM
Need to move large file(s) to lots of machines on my network. suggestions? BrianK Linux - Networking 3 05-12-2006 02:25 AM
Can I move my HD from 1 machine to another? scooterNotMoped Linux - Hardware 1 11-06-2005 07:31 PM


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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration