Scripts for turning Proxy server on/off::
- /etc/environment contains only one line i.e. ‘$PATH:…’. And nothing else.
So! If you want to automate the process of turning proxy on and off without having to type allot. you can make two executable shell scripts proxyon.sh and proxyoff.sh as:
1 |
|
1 |
|
How to use: Once you have made these scripts, make them executable, you may keep them anywhere you like. To turn on proxy all you have to do is go to the directory containing the ‘proxyon.sh’ script and then you need to type sudo ./proxyon.sh {host} {port}. As an example consider this:
1 | $ sudo ./proxyon.sh 10.2.20.17 8080 |
Where ‘10.2.20.17’ is the proxy server’s IP - you can also type something like myproxy.server.com - and ‘8080’ is the port. After that just log out and login to your account, to make sure that everything is set. You can start using the internet or whatever then. And when you want to turn the proxy off, go to the directory containing ‘proxyoff.sh’ and type:
1 | $ sudo ./proxyoff.sh |
This will unset all of your proxies. Now logout and login again to switch to normal mode.