Tuesday, March 9, 2010

Running Rsync Via Proxy

One way to get the latest Slackware updates is by running rsync to syncronize your local repository and the main repository that hold the Slackware packages. Eric Hameleers has provided a great script called rsync_current.sh and how i modified this tool has been discussed on my previous post. In general, it works, except for one problem, when your computer is connecting to the Internet through a proxy.

My workstation at my office is connected to the Internet through a proxy, so i can't use normal rsync to work normally. I browsed the web and i found this site which tells us about how we should modify our squid configuration to allow rsync connection from any computer from our local networks. I asked my sysadmin to try this script. He agreed and he updated the squid configuration on the proxy.

Next, i need to update my environment variable RSYNC_PROXY to the host of the proxy and also the port. Let's say you are running a proxy on 192.168.1.1 and port 8080, then you need to run export RSYNC_PROXY="192.168.1.1:8080 and then you can start running your rsync command (or script in my case).

Remember that this change is not permanent. It will last until you close your terminal, so the solution is to add this line into your ~/.bash_profile or /etc/profile if you want it to be globaly available to all of your users.

If you want to run the script periodically, you can use cronjobs to do it for you. I set to download the update from Slackware mirrors at around 11 PM at night when the bandwidth is not utilized.

Hope this small article helps you out to work with rsync when you are behind a proxy