LinuxQuestions.org
Review your favorite Linux distribution.
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-17-2010, 09:05 AM   #1
ctkroeker
Senior Member
 
Registered: May 2005
Posts: 1,565
Blog Entries: 1

Rep: Reputation: 50
Question Backup Rsync+SSH Server


I know this question has been done to death but I can't find anything that applies directly to this situation.

I have a group of around 20 production machines, which need to be backed up nightly to a Server. Since the "push" method wouldn't work to well as the machines are turned off for night, I need a pull method that issues a shutdown command after that machine is done backing up.

I've used Cron with SSH+Rsync for nightly backup push jobs, i.e. the client sends it's backup to the server
Code:
# m h  dom mon dow   command
00 01 * * * /usr/bin/rsync -avz --exclude-from=/home/client4/.exclude -r --delete -e ssh /home/client4/ server@server:/backup/client4
But I want the Server to automatically pull backups from 20 machines with no human intervention (passwordless) and without having to wade through 20 entries in cron to make little changes.

I'm thinking Cron is going to get a bit crowded and messy, so is there an easy way to script what I want? Do I still have to make a separate script for each machine, this would defeat the purpose of scripting and I could just stay with cron. What setup is best suited in this situation?
 
Old 03-17-2010, 09:10 AM   #2
centosboy
Senior Member
 
Registered: May 2009
Location: london
Distribution: centos5
Posts: 1,137

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by ctkroeker View Post
I know this question has been done to death but I can't find anything that applies directly to this situation.

I have a group of around 20 production machines, which need to be backed up nightly to a Server. Since the "push" method wouldn't work to well as the machines are turned off for night, I need a pull method that issues a shutdown command after that machine is done backing up.

I've used Cron with SSH+Rsync for nightly backup push jobs, i.e. the client sends it's backup to the server
Code:
# m h  dom mon dow   command
00 01 * * * /usr/bin/rsync -avz --exclude-from=/home/client4/.exclude -r --delete -e ssh /home/client4/ server@server:/backup/client4
But I want the Server to automatically pull backups from 20 machines with no human intervention (passwordless) and without having to wade through 20 entries in cron to make little changes.

I'm thinking Cron is going to get a bit crowded and messy, so is there an easy way to script what I want? Do I still have to make a separate script for each machine, this would defeat the purpose of scripting and I could just stay with cron. What setup is best suited in this situation?
try rsnapshot

http://www.cyberciti.biz/faq/redhat-...apshot-server/

http://rsnapshot.org/


it is very configurable too, quick and easy.
it is possible to have it up and running in a few minutes
 
Old 03-17-2010, 10:27 AM   #3
ctkroeker
Senior Member
 
Registered: May 2005
Posts: 1,565

Original Poster
Blog Entries: 1

Rep: Reputation: 50
Thanks. That looks pretty good. How is this sample config? I think that would accomplish what I want, except for shutting down the machine after it's done being backed up at the end of the day...

Code:
# rsnapshot.conf

config_version 1.2

snapshot_root /backup/.snapshots/

loglevel 3
logfile /var/log/rsnapshot

exclude_file /.exclude
rsync_long_args --delete --numeric-ids --relative -avz

cmd_rsync /usr/bin/rsync
cmd_ssh /usr/bin/ssh
#cmd_cp /bin/cp
cmd_rm /bin/rm
cmd_logger /usr/bin/logger
cmd_du /usr/bin/du

retain daily 7
retain weekly 4
retain monthly 12

backup client1@client1:/home/ client1/
backup client2@client2:/home/ client2/
backup client3@client3:/home/ client3/
backup client4@client4:/home/ client4/
 
Old 03-17-2010, 11:38 AM   #4
centosboy
Senior Member
 
Registered: May 2009
Location: london
Distribution: centos5
Posts: 1,137

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by ctkroeker View Post
Thanks. That looks pretty good. How is this sample config? I think that would accomplish what I want, except for shutting down the machine after it's done being backed up at the end of the day...

Code:
# rsnapshot.conf

config_version 1.2

snapshot_root /backup/.snapshots/

loglevel 3
logfile /var/log/rsnapshot

exclude_file /.exclude
rsync_long_args --delete --numeric-ids --relative -avz

cmd_rsync /usr/bin/rsync
cmd_ssh /usr/bin/ssh
#cmd_cp /bin/cp
cmd_rm /bin/rm
cmd_logger /usr/bin/logger
cmd_du /usr/bin/du

retain daily 7
retain weekly 4
retain monthly 12

backup client1@client1:/home/ client1/
backup client2@client2:/home/ client2/
backup client3@client3:/home/ client3/
backup client4@client4:/home/ client4/
use rsnaphot -t <weekly|daily|hourly|monthly> to test your config.

as for shutdown, you can add this as a sep cron on the server itself...?
 
Old 03-17-2010, 01:08 PM   #5
ctkroeker
Senior Member
 
Registered: May 2005
Posts: 1,565

Original Poster
Blog Entries: 1

Rep: Reputation: 50
Yeah, I guess I could do it individually on every machine, or I get Wake on Lan. Thank you!
 
Old 03-18-2010, 03:58 AM   #6
centosboy
Senior Member
 
Registered: May 2009
Location: london
Distribution: centos5
Posts: 1,137

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by ctkroeker View Post
Yeah, I guess I could do it individually on every machine, or I get Wake on Lan. Thank you!
or add that bit to the rsnapshot.conf file....the backup_script option...check the examples
 
Old 03-18-2010, 05:55 AM   #7
ctkroeker
Senior Member
 
Registered: May 2005
Posts: 1,565

Original Poster
Blog Entries: 1

Rep: Reputation: 50
I was wondering if that would work, but how does the script know which machine to /sbin/shutdown -h now?
 
Old 03-18-2010, 10:18 AM   #8
centosboy
Senior Member
 
Registered: May 2009
Location: london
Distribution: centos5
Posts: 1,137

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by ctkroeker View Post
I was wondering if that would work, but how does the script know which machine to /sbin/shutdown -h now?
add a line for backup_script

something like

Code:
backup_script /usr/sbin/ssh user@server "shutdown -h now"
underneath the relevant backup line.

check the examples in /etc/rsnapshot.conf and test first.....with any commands...other then shutdown of course
 
  


Reply

Tags
cron



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
rsync server backup through ssh tunnel issue vidhut Linux - Networking 1 01-06-2009 03:53 AM
Using RSync to backup a secondary off-site backup server pezdspencer Linux - Software 4 06-29-2007 03:40 PM
Rsync server vs rsync over ssh humbletech99 Linux - Networking 1 10-18-2006 12:10 PM
Using rsync for local server backup. Some issues. enygma Linux - Networking 0 02-03-2005 01:46 PM

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

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