LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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, 12:56 AM   #1
sagar666
Member
 
Registered: Feb 2013
Posts: 212

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, 03:36 AM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
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, 12:11 AM   #3
sagar666
Member
 
Registered: Feb 2013
Posts: 212

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

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, 10:31 PM   #5
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,983

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
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



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 09:35 AM
[SOLVED] rsync execution issue with crontab - Have given full path to rsync too!! Prabagaran Linux - Server 6 04-15-2011 01:39 AM
rsync memory usage over ssh tajamari Linux - Software 9 09-20-2007 05:52 AM
rsync reduce cpu usage dtra Linux - Software 0 05-25-2005 08: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 04:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 03:33 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