Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    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:

    rsync 'ssh -p remoteSSHPort' /etc/squid/squid.conf  newUser ARROBA remoteHost:/etc/squid/squid.conf
    Any idea?

  2. #2
    Linux Guru reed9's Avatar
    Join Date
    Feb 2009
    Boston, MA
    1. Ssh into your server
    /etc/init.d/<service> stop
    /etc/init.d/<service> start
    2. Set up permissions with sudo.

  3. #3
    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)

  4. $spacer_open

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts