Laptop proxy switch


I got fed up of having to switch proxy settings on and off between sites, so I wrote this little script to help me!

There are a few configuration steps to go through first:

  1. Go into Control Center and set Network Proxy to use the system proxy settings.
  2. Go into Yast and set your proxy settings to on.
  3. cp /etc/sysconfig/proxy /etc/sysconfig/proxy.on
  4. Go into Yast and set your proxy settings to off.
  5. cp /etc/sysconfig/proxy /etc/sysconfig/
  6. Set Firefox to use system settings for proxy
  7. Put this script somewhere and make it executable:
    # Replace the IP address below with the address of your proxy server.
    ping -c 1 -s 32
    if [ $? = 0 ]
    # If I can ping my proxy server then use it!
    sudo cp /etc/sysconfig/proxy.on /etc/sysconfig/proxy
    # If I can't ping my proxy server then switch off!
    sudo cp /etc/sysconfig/ /etc/sysconfig/proxy
  8. Call this script at startup – I execute it from my .profile script.

NB: you will need to add the executing user your SUDOers list to run without a password for this script to work – you could alternatively change the permissions on the /etc/sysconfig/proxy file to avoid this.

(Visited 1 times, 1 visits today)


  • supermathie says:

    If you need any sort of proxy management or fine-grained control, check out FoxyProxy for Firefox. It also makes it dead simple to toggle between proxies.

    Granted, it’s not systemwide, but also makes things rather easy to control.

  • Leave a Reply

    Your email address will not be published. Required fields are marked *