LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 06-26-2008, 09:17 AM   #1
siva19185
LQ Newbie
 
Registered: Jun 2008
Posts: 21

Rep: Reputation: 15
Crontap to copy a dire


Can anyone tell me,

Crontab for the task

To copy one directory to a remote server....

please..
 
Old 06-26-2008, 10:24 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Please, give us some more details. How do you access the remote server (ftp, ssh/scp, ...)? What the scheduling of this task should be (every day, every week, ...)? And how the directory to copy is selected (fixed name, date, ...)?
 
Old 06-27-2008, 08:56 AM   #3
siva19185
LQ Newbie
 
Registered: Jun 2008
Posts: 21

Original Poster
Rep: Reputation: 15
To copy one directory daily to the remote server....
 
Old 06-27-2008, 09:22 AM   #4
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
You are not very prodigal of details, aren't you? Anyway, first you have to establish what command to use for copying a directory. If you can access the remote server via ssh you can use either scp -R or rsync. Then you can insert the command directly in the crontab or put it in a script and execute this script from the crontab. I assume you know how to edit the crontab, so you can simply do something like:
Code:
0 6 * * * /usr/bin/scp -Rq /path/to/dir user@host:/path/to/destination
where you have to substitute the /path/to/dir, user, host and /path/to/destination items with their real values. The above crontab entry executes every day at 6:00 AM. To have this accomplished automatically, you have to set-up a passwordless authentication using ssh-keys. Similarly, using rsync over ssh you can try something like
Code:
0 6 * * * /usr/bin/rsync -az -e ssh /path/to/dir user@host:/path/to/destination

Last edited by colucix; 06-27-2008 at 09:25 AM.
 
Old 06-28-2008, 03:05 AM   #5
siva19185
LQ Newbie
 
Registered: Jun 2008
Posts: 21

Original Poster
Rep: Reputation: 15
Thamk very much for ur clarification...
 
  


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
In Dire need of help with D*mn Small Linux m0dul4rX 2 Linux - Newbie 2 07-04-2006 04:21 AM
In dire need for some space :-) l2g Slackware 7 05-11-2004 08:14 PM
In dire need of help bobs987 Linux - Hardware 0 03-20-2004 03:23 PM
need dire help! well not really... DIRE. Peingune Linux - Hardware 4 11-03-2002 03:59 PM
In dire need of DNS help! katana Linux - General 5 06-19-2001 01:37 AM


All times are GMT -5. The time now is 03:09 PM.

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