How to best handle three offices with three different sets of repositories and different proxies?
Rainer M Krug
rainer.linux at krugs.de
Thu Nov 29 00:48:29 PST 2007
Thanks a million - that looks much easier then I thought. I will
definitely look into that
Rainer
Grant McWilliams wrote:
>
> >
> > *The shell script*
> >
> > #!/bin/bash
> >
> > smart config --set http-proxy=
> > http://username:password@proxy-ip:port
> > < http://username:password@proxy-ip/>
> > smart config --set
> ftp-proxy=http://username:password@proxy-ip:port
> > <http://username:password@proxy-ip/>
> >
> > smart channel --add channels.txt
> >
> > smart mirror --add mirrors.txt
>
> this solution sounds easy enough - but if I switch to the other site,
> don't I have to remove the channels and mirrors from the previos one to
> only have one set?
>
>
> I guess you could disable the channels but it would seem like the logic
> would be more complex then just having seperate channel files.
>
> smart channel --remove-all
> smart mirror --show | grep '^h' | xargs smart mirror --remove-all
>
> These lines will remove all channels and mirrors. You could add just a
> bit to the script so it was something like this.
>
> #!/bin/bash
>
> if [ -n $1 ]
> then
> echo "You need to specify a site argument"
> exit 192
> else
> SITE=$1
> fi
>
>
> case "$SITE" in
> site1)
> smart config --set http-proxy=http://username:password@proxy-ip:port
> <http://username:password@proxy-ip/>
> smart config --set ftp-proxy= http://username:password@proxy-ip:port
> smart channel --add site1-channels.txt
> smart mirror --add site1-mirrors.txt
> echo "Smartpm configured for site1"
> ;;
> site2)
> smart config --set http-proxy=http://username:password@proxy-ip:port
> <http://username:password@proxy-ip/>
> smart config --set ftp-proxy=http://username:password@proxy-ip:port
> smart channel --add site2-channels.txt
> smart mirror --add site2-mirrors.txthttp://mapper.tat.fws.gov/ogcwms/WmsServlet?service=wms&servicename=crithab&VERSION=1.1.0&REQUEST=getcapabilities
> echo "Smartpm configured for site1"
> ;;
> *)
> commands;
> ;;
> esac
>
> exit 0
>
>
> The automatic proxy code looks something like this
>
> #!/bin/bash
>
> PROXYSERVER="proxy.domain.com <http://proxy.domain.com>"
> PROXYPORT="8080"
>
> if ping -c2 $PROXYSERVER &> /dev/null
> then
> smart config --set
> http-proxy=http://username:password@PROXYSERVER:PROXYPORT
> <http://username:password@proxy-ip/>
> smart config --set ftp-proxy=http://username:password@PROXYSERVER:PROXYPORT
> else
> smart config --remove http-proxy
> smart config --remove ftp-proxy
> fi
>
> You could expand this to check for more than one proxy server and
> depending on which one it found it would set the proxy settings.
>
> Grant
>
> --
> Some people, when confronted with a problem, think "I know, I'll use
> Windows."
> Now they have two problems.
More information about the Smart
mailing list