User avatar
makem2
Posts: 233
Joined: Tue Jul 02, 2013 9:12 am
Location: Essex
Contact: Website

cron job

Tue Jul 02, 2013 9:27 am

I have this cron job:

crontab -e
0 5 * * * rsync -av --delete /media/USBHDD1/shares /media/USBHDD2/shares/

This backs up data from one drive attached to the PI to another attached drive.

I want to backup a folder on a PC on the network to USBHDD1 but can't work out what the syntax should be. Can someone assist please?
If I also want to backup a folder from another PC do I just add the same line again?

joebloggs
Posts: 10
Joined: Wed Jun 06, 2012 10:21 pm

Re: cron job

Tue Jul 02, 2013 11:36 am

Might need a little more info..

What you are saying is mostly correct, if you wanted to run rsync to sync something else you can put a new line in the crontab file which is almost the same as the old one.

The difference would be that if you need to talk to a remote computer, that remote computer needs some way of talking back.

I think with rsync there are two ways, either running rsync or an SSH server on the PC, both of which would allow rsync to talk to the PC. Having rsync running on both machines would be best, but if you happen to have an SSH server on the PC already it should be able to use it.

The line in the crontab file would then be something like this:

0 5 * * * rsync -av USERNAME@HOST:SRC DEST

Where USERNAME is the login name, HOST is the hostname of the PC and SRC is the directory to be copied, DEST is the destination on the Pi.


Hope this helps,

post back with details of the system ruining on the PC if this explanation isn't detailed enough for you.

User avatar
RaTTuS
Posts: 10558
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Contact: Twitter YouTube

Re: cron job

Tue Jul 02, 2013 11:42 am

^WHS
but try it from the command line 1st
rsync -va user@src:/directory /directory

you will have to use

ssh-keygen -t rsa
ssh-copyid user@src

to enable you to login automagically
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

User avatar
makem2
Posts: 233
Joined: Tue Jul 02, 2013 9:12 am
Location: Essex
Contact: Website

Re: cron job

Tue Jul 02, 2013 11:47 am

Thanks for your input.

I have rsync installed:

sudo apt-get install rsync

I am using the web page:

http://www.howtogeek.com/139433/how-to- ... ge-device/

to learn.

Both machines are Windows 7 and I would like to backup the profiles which have both been moved to D: drive.

User avatar
RaTTuS
Posts: 10558
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Contact: Twitter YouTube

Re: cron job

Tue Jul 02, 2013 11:53 am

if you want to ssh into a windows machine then I think you need to add a ssh server
see
freesshd
putty may also have the option [not sure]
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

User avatar
makem2
Posts: 233
Joined: Tue Jul 02, 2013 9:12 am
Location: Essex
Contact: Website

Re: cron job

Tue Jul 02, 2013 11:54 am

RaTTuS wrote:^WHS
but try it from the command line 1st
rsync -va user@src:/directory /directory

you will have to use

ssh-keygen -t rsa
ssh-copyid user@src

to enable you to login automagically
^WHS - sorry don't understand this.

I understand the other terms but don't understand the logic behind them.

The Pi is always on.

Sorry, I am only 4 days into the learning curve.

User avatar
makem2
Posts: 233
Joined: Tue Jul 02, 2013 9:12 am
Location: Essex
Contact: Website

Re: cron job

Tue Jul 02, 2013 1:09 pm

makem2 wrote:
RaTTuS wrote:^WHS
but try it from the command line 1st
rsync -va user@src:/directory /directory

you will have to use

ssh-keygen -t rsa
ssh-copyid user@src

to enable you to login automagically
^WHS - sorry don't understand this.
OH! WHAT HE SAYS!!!!

Where is my head????

User avatar
makem2
Posts: 233
Joined: Tue Jul 02, 2013 9:12 am
Location: Essex
Contact: Website

Re: cron job

Tue Jul 02, 2013 5:15 pm

joebloggs wrote:Might need a little more info..

What you are saying is mostly correct, if you wanted to run rsync to sync something else you can put a new line in the crontab file which is almost the same as the old one.

The difference would be that if you need to talk to a remote computer, that remote computer needs some way of talking back.

I think with rsync there are two ways, either running rsync or an SSH server on the PC, both of which would allow rsync to talk to the PC. Having rsync running on both machines would be best, but if you happen to have an SSH server on the PC already it should be able to use it.

The line in the crontab file would then be something like this:

0 5 * * * rsync -av USERNAME@HOST:SRC DEST

Where USERNAME is the login name, HOST is the hostname of the PC and SRC is the directory to be copied, DEST is the destination on the Pi.


Hope this helps,

post back with details of the system ruining on the PC if this explanation isn't detailed enough for you.
Can I run rsync on a Windows 7 PC?

I have putty and winSCP

I am not sure what you mean by SSH server

Can I not just do what I want using samba shares?

Return to “Beginners”