LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-20-2005, 08:07 PM   #1
crispyleif
Member
 
Registered: Mar 2005
Location: Norway, by the coast
Distribution: Debian and the likes
Posts: 190

Rep: Reputation: 31
cron & backup howto ?


Hi there.

One thing I sadly haven't gotten insto my fingers as a newbie is cron.

I would like to back up my pictures folders (the folder I put my pictures in, not that "my pictures" )daily, instead of manually moving pictures over to the server regularly. Also, if it is possible (something just tells me it is) , to rename files with the same name rather than overwriting them. Very usuful since the camera names the pictures P4500021 etc.


All thoughts welcome
 
Old 11-20-2005, 08:17 PM   #2
Mad Scientist
Member
 
Registered: May 2003
Posts: 167

Rep: Reputation: 30
For the functionality of cron, I would just search Google for "crontab" or some such thing and find what you need that way. Some results I just found are

http://www.mkssoftware.com/docs/man1/crontab.1.asp
http://www.ss64.com/bash/crontab.html

As far as backing up your pictures, you can use the "rsync" command. The beauty of that command is that it only copies the differences between the two directories. For instance, say you had one directory called "pictures" in your home directory on the client machine, and you wanted to back it up the same directory on the server machine. From the client, you could do

Code:
rsync -av --delete --progress -e ssh $HOME/pictures username@server:$HOME/
The first time you run this command, it may take a while, because it will copy all the files in the directory "picture" on the client remotely into the directory "pictures" on the server. Now, say you add 20 pictures from your most recent trip to your "pictures" directory. Running the same command again, you will notice that only those 20 files will be copied. Rsync will know that the other files are the exact same and won't try to re-copy them. The "--delete" flag removes any files in the "pictures" directory on the server that you have removed from the "pictures" directory on the client. You may or may not want that functionality.

Now it comes down to your file name situation. If the name of the file changes, rsync will update the corresponding file on the server. Say you have one file called "img001.jpg" in your "pictures" directory. You run rsync, and that file gets copied over to the "pictures" directory on the server. Now, say you rename "img001.jpg" to "mypic.jpg", and you upload a new "img001.jpg" to your "pictures" directory. I believe that if you run rsync again, the old "img001.jpg" will be updated with the new name (i.e. "mypic.jpg"), and the new "img001.jpg" will be copied over as is.

Try this stuff out just to see how it works, and don't use the "--delete" flag until you're sure that you want to start removing files from your backups that you have chosen to remove from your client machine.

If that doesn't help, please feel free to post again, or wait for the other helpful responses that are sure to follow.
 
Old 11-20-2005, 08:17 PM   #3
Mad Scientist
Member
 
Registered: May 2003
Posts: 167

Rep: Reputation: 30
For the functionality of cron, I would just search Google for "crontab" or some such thing and find what you need that way. Some results I just found are

http://www.mkssoftware.com/docs/man1/crontab.1.asp
http://www.ss64.com/bash/crontab.html

As far as backing up your pictures, you can use the "rsync" command. The beauty of that command is that it only copies the differences between the two directories. For instance, say you had one directory called "pictures" in your home directory on the client machine, and you wanted to back it up the same directory on the server machine. From the client, you could do

Code:
rsync -av --delete --progress -e ssh $HOME/pictures username@server:$HOME/
The first time you run this command, it may take a while, because it will copy all the files in the directory "picture" on the client remotely into the directory "pictures" on the server. Now, say you add 20 pictures from your most recent trip to your "pictures" directory. Running the same command again, you will notice that only those 20 files will be copied. Rsync will know that the other files are the exact same and won't try to re-copy them. The "--delete" flag removes any files in the "pictures" directory on the server that you have removed from the "pictures" directory on the client. You may or may not want that functionality.

Now it comes down to your file name situation. If the name of the file changes, rsync will update the corresponding file on the server. Say you have one file called "img001.jpg" in your "pictures" directory. You run rsync, and that file gets copied over to the "pictures" directory on the server. Now, say you rename "img001.jpg" to "mypic.jpg", and you upload a new "img001.jpg" to your "pictures" directory. I believe that if you run rsync again, the old "img001.jpg" will be updated with the new name (i.e. "mypic.jpg"), and the new "img001.jpg" will be copied over as is.

Try this stuff out just to see how it works, and don't use the "--delete" flag until you're sure that you want to start removing files from your backups that you have chosen to remove from your client machine.

If that doesn't help, please feel free to post again, or wait for the other helpful responses that are sure to follow.
 
Old 11-22-2005, 01:57 AM   #4
crispyleif
Member
 
Registered: Mar 2005
Location: Norway, by the coast
Distribution: Debian and the likes
Posts: 190

Original Poster
Rep: Reputation: 31
Seems rsync was was I needed, thanks for the very informative reply !

I do google for problems/challenges as they arise, just hadn't found your solution
So, thanks again.
 
Old 11-23-2005, 12:26 PM   #5
Mad Scientist
Member
 
Registered: May 2003
Posts: 167

Rep: Reputation: 30
Not a problem at all. Post some more if you run into other troubles.
 
  


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
Cron Backup TPupAZ Linux - Software 7 02-11-2005 07:49 AM
Can a backup be done with cron? sadly so Solaris / OpenSolaris 3 02-03-2005 01:28 AM
Cron Backup question lil_drummaboy Linux - General 2 12-07-2004 12:39 AM
Backup Question / Cron TPupAZ Linux - Software 1 06-11-2004 01:17 AM
cron job - backup medamnit Linux - Newbie 4 05-24-2002 03:37 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:07 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
Open Source Consulting | Domain Registration