Results 1 to 3 of 3
Hi. I have two servers. #1 is the main server and #2 is only used in case the first one is down. Both of them are in the same LAN. ...
- 12-10-2010 #1Just Joined!
- Join Date
- Mar 2010
- Posts
- 11
rsync between two different servers
Hi. I have two servers. #1 is the main server and #2 is only used in case the first one is down. Both of them are in the same LAN. Both are debian Lenny configured the same way. For instance, if #1 has a problem, I simply disconnect it, set #1's IPs to #2 and I have my system ready. The only matter here is that there are plenty of files that need to be syncronized between #1 and #2.
So I've created a newUser and added it to root group. I created a sync script in my main server (#1) that copies files using this new 'almost root' user with ssh keys and It works as expected. The problem is, for instance, if I want to rsync a .conf file, say squid.conf. Firstly I must stop squid service, then do the sync, and finally start the service again. At this point the two issues appear:
1. How can I remotely start/stop a service?
2. How can I do Nș1 withour being root (The new user I've created for this task is a member of root group)
My script is like the following:
Any idea?Code:rsync 'ssh -p remoteSSHPort' /etc/squid/squid.conf newUser ARROBA remoteHost:/etc/squid/squid.conf
- 12-10-2010 #2
1. Ssh into your server
2. Set up permissions with sudo.Code:/etc/init.d/<service> stop /etc/init.d/<service> start
- 12-11-2010 #3Just Joined!
- Join Date
- Mar 2010
- Posts
- 11
1. Is clear. I have to log in with my newUser with ssh to my remote server, then stop the service
2. How can I use sudo without needing to put my password? Remember that I want to perform this task periodically with cron (and I have properly set up ssh login with rsa keys for newUser)


Reply With Quote
