<div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d"><br>><br>> *The shell script*<br>><br>>     #!/bin/bash
<br>><br>>     smart config --set http-proxy=<br>>     <a href="http://username:password@proxy-ip:port" target="_blank">http://username:password@proxy-ip:port</a><br></div>>     <<a href="http://username:password@proxy-ip/" target="_blank">
http://username:password@proxy-ip/</a>><br><div class="Ih2E3d">>     smart config --set ftp-proxy=<a href="http://username:password@proxy-ip:port" target="_blank">http://username:password@proxy-ip:port</a><br></div>
>     <<a href="http://username:password@proxy-ip/" target="_blank">http://username:password@proxy-ip/</a>><br><div class="Ih2E3d">><br>>     smart channel --add channels.txt<br>><br>>     smart mirror --add 
mirrors.txt<br><br></div>this solution sounds easy enough - but if I switch to the other site,<br>don't I have to remove the channels and mirrors from the previos one to<br>only have one set?<br><div class="Ih2E3d"></div>
</blockquote><div><br>I guess you could disable the channels but it would seem like the logic would be more complex then just having seperate channel files.<br><br><div style="margin-left: 40px;">smart channel --remove-all
<br></div><div style="margin-left: 40px;">smart mirror --show | grep '^h' | xargs smart mirror --remove-all<br></div> <br>These lines will remove all channels and mirrors. You could add just a bit to the script so it was something like this.
<br><br>#!/bin/bash<br><br>if [ -n $1 ]<br>then<br><div style="margin-left: 40px;">echo "You need to specify a site argument"<br>exit 192<br></div>else<br><div style="margin-left: 40px;">SITE=$1</div>fi<br><br><br>
case "$SITE" in
<br>    site1)
<br><div class="Ih2E3d"><div style="margin-left: 40px;">smart config --set http-proxy=<a href="http://username:password@proxy-ip/" target="_blank">http://username:password@proxy-ip:port</a><br>smart config --set ftp-proxy=
<a href="http://username:password@proxy-ip:port">http://username:password@proxy-ip:port</a><br></div><div style="margin-left: 40px;">smart channel --add site1-channels.txt<br>smart mirror --add site1-mirrors.txt<br>echo "Smartpm configured for site1"
<br></div></div>
         ;;
<br>    site2)
<br><div class="Ih2E3d">
<div style="margin-left: 40px;">smart config --set http-proxy=<a href="http://username:password@proxy-ip/" target="_blank">http://username:password@proxy-ip:port</a><br>
smart config --set ftp-proxy=<a href="http://username:password@proxy-ip:port">http://username:password@proxy-ip:port</a><br>
</div>
<div style="margin-left: 40px;">smart channel --add site2-channels.txt<br>
smart mirror --add site2-mirrors.txt<br>
echo "Smartpm configured for site1"<br>
</div>
</div>
         ;;
<br>    *)
<br>         commands;
<br>         ;;
<br>esac<br><br>exit 0<br><br><br>The automatic proxy code looks something like this<br><br>#!/bin/bash<br><br>PROXYSERVER="<a href="http://proxy.domain.com">proxy.domain.com</a>"<br>PROXYPORT="8080"<br>
<br>if ping -c2 $PROXYSERVER &> /dev/null<br>then<br><div style="margin-left: 40px;">smart config --set http-proxy=<a href="http://username:password@proxy-ip/" target="_blank">http://username:password@PROXYSERVER:PROXYPORT
</a><br>
smart config --set ftp-proxy=<a href="http://username:password@PROXYSERVER:PROXYPORT">http://username:password@PROXYSERVER:PROXYPORT</a><br></div>else<br><div style="margin-left: 40px;">smart config --remove http-proxy<br>
smart config --remove ftp-proxy<br></div>fi<br><br>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.<br><br></div></div>Grant<br><br>-- <br>
Some people, when confronted with a problem, think "I know, I'll use Windows." <br>Now they have two problems.