0

I want to make a script that sets and unsets SYSTEM WIDE proxy just as what happens through the network settings.

I tried this answers gsettings part but it does not work in 14.04

Could Anyone please help? Its FRUSTRATING to open the network settings every time!

Nirmik
  • 7,868
  • Tried http://askubuntu.com/a/526900/158442 ? – muru Nov 04 '14 at 06:32
  • @muru Its not working! :( – Nirmik Nov 04 '14 at 06:46
  • "Its not working!" is meaningless. How is it not working? What errors do you get? – muru Nov 04 '14 at 06:48
  • @muru No errors... but thge proxies are not picked up by any browsers nor reflected in the network manager – Nirmik Nov 04 '14 at 07:07
  • How are you running it? What's the output of gsettings get org.gnome.system.proxy mode? – muru Nov 04 '14 at 07:10
  • it says 'manual'... but the changes dont take effect... logout isnt needed right? – Nirmik Nov 04 '14 at 07:25
  • Changes to gsettings and apt.conf should take effect immediately, but /etc/environment needs a logout. What about gsettings get org.gnome.system.proxy.http host, or one of the other values, and the files /etc/apt/apt.conf and /etc/environment? Are they changed? – muru Nov 04 '14 at 07:27
  • @muru ... okay... i solved the issue... thanx a lot for the help... ill post what i did as the answer.. turns out i didnt need setting of proxy address as i have already done it through gui once... i just needed mode changing! – Nirmik Nov 04 '14 at 07:46

1 Answers1

1

Okay,

Here is what i did...

I just needed a 'Proxy Mode Changer'... Setting the proxies , i did through gui... Now i just needed changing mode...

Here is the script i made... SIMPLE as anything ->

#!/bin/bash

state=$(gsettings get org.gnome.system.proxy mode)

if [ $state == "'none'" ]; then
        gsettings set org.gnome.system.proxy mode 'manual'
elif [ $state == "'manual'" ]; then
        gsettings set org.gnome.system.proxy mode 'none'
fi
Nirmik
  • 7,868