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:
- Go into Control Center and set Network Proxy to use the system proxy settings.
- Go into Yast and set your proxy settings to on.
- cp /etc/sysconfig/proxy /etc/sysconfig/proxy.on
- Go into Yast and set your proxy settings to off.
- cp /etc/sysconfig/proxy /etc/sysconfig/proxy.off
- Set Firefox to use system settings for proxy
- Put this script somewhere and make it executable:
#!/bin/bash # Replace the IP address below with the address of your proxy server. ping 172.16.1.1 -c 1 -s 32 if [ $? = 0 ] then # If I can ping my proxy server then use it! sudo cp /etc/sysconfig/proxy.on /etc/sysconfig/proxy else # If I can't ping my proxy server then switch off! sudo cp /etc/sysconfig/proxy.off /etc/sysconfig/proxy fi
- 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.