LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices



Reply
 
Search this Thread
Old 03-22-2013, 01:56 AM   #1
sagar666
Member
 
Registered: Feb 2013
Posts: 145

Rep: Reputation: Disabled
rsync usage


Hi,

we are having five remote locations.In head office all files will move to one directory called /printing . i want to move these files into five remote locations using rsync and if i use rsync -v -e ssh /printing hubli@192.168.25.11:/printing it transfers only existing files in printing directory, but our users will move the files every five minutes. so i cant execute every time as mentioned above command.so i want to sync automatically every five minutes.please give me procedure to do this .i have one idea using crontab tool i can do this but is der any other idea by using only rsync tool.please help me out
 
Old 03-22-2013, 04:36 AM   #2
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.6, Centos 5.10
Posts: 16,324

Rep: Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041
I'd use cron, as you suggest. Its simpler than setting up rsync in a daemon; you'd be basically re-creating cron functionality.
 
Old 03-23-2013, 01:11 AM   #3
sagar666
Member
 
Registered: Feb 2013
Posts: 145

Original Poster
Rep: Reputation: Disabled
But i want use rsync only is it possible??
 
Old 03-23-2013, 08:19 AM   #4
yzT!
Member
 
Registered: Jan 2013
Distribution: Debian
Posts: 148

Rep: Reputation: 2
5 * * * * "/usr/bin/rsync -v -e ssh /printing hubli@192.168.25.11:/printing"

Don't know if you can add the command like that. If you can't, just write a script whatever.sh with that command within it, and in the crontab line write /path/to/whatever.sh
 
Old 03-23-2013, 11:31 PM   #5
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora
Posts: 2,582

Rep: Reputation: 480Reputation: 480Reputation: 480Reputation: 480Reputation: 480
yzT! has it. put something like that in cron, that is what it is for. you can set it to run every 5min so the first option in cron would be */5 not just 5 as that will run at the 5min mark every hour so 1:05, 2:05, etc... */5 will run every 5min.

you can shorten that as well to */2 or something silly. do keep in mind that if the total amount of files to be pushed across your WAN/LAN takes longer then2-5min then you will run into errors were cron will crash as rsync will still be running and you can only have 1 instance of rsync running at a time.

so create you foo.sh and as you have 5 remote servers to receive the data set the script up to rsync to all 5, one at at time, then just call the script once every five minutes in cron.

Code:
#!/bin/bash
LOG=/path/to/log/file/for/this/script

rsync -aviS /path/to/printing remote_user@remote_IP:/path/to/remote/printing/directory  >> ${LOG}

## do this four more times for each of the remaining remote servers###
exit
then run crontab -e as the user this script will be run under

Code:
*/5     *     *     *     *     /path/to/foo.sh
poof you are fin.
 
  


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
[SOLVED] rsync usage to make one directory look exactly like other rohit.dhaval1 Linux - Software 4 02-10-2012 10:35 AM
[SOLVED] rsync execution issue with crontab - Have given full path to rsync too!! Prabagaran Linux - Server 6 04-15-2011 02:39 AM
rsync memory usage over ssh tajamari Linux - Software 9 09-20-2007 06:52 AM
rsync reduce cpu usage dtra Linux - Software 0 05-25-2005 09:04 PM
how to determine cpu usage, memory usage, I/O usage by a particular user logged on li rags2k Programming 4 08-21-2004 05:45 AM


All times are GMT -5. The time now is 08:11 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration