LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   enable broadband 3G connection from desktop icon (https://www.linuxquestions.org/questions/linux-newbie-8/enable-broadband-3g-connection-from-desktop-icon-839066/)

angelo_maci 10-19-2010 10:10 AM

enable broadband 3G connection from desktop icon
 
Hello,
I am able to configure a working 3G connection but I do not want it to be enabled at startup. I want it "on-demand" and I need that it is easy for non-skilled persons, that is double-clicking a desktop icon.
So I think I have to call a script or something else but I do not know the command.
Thanks.

David the H. 10-19-2010 11:23 AM

Here's a simple bash script that will toggle between two commands. It saves the current state in a hidden file in your home directory, and checks it each time to see what should be done. If the hidden file doesn't exist or doesn't contain the correct information, it defaults to running the "off" command.
Code:

#!/bin/bash

[[ -r $HOME/.netonoff ]] && . $HOME/.netonoff


case ${status:-on} in

    off) [insert "ON" command here]
          status=on
    ;;

    *)  [insert "OFF" command here]
          status=off
    ;;

esac

echo "status=$status" > $HOME/.netonoff

exit 0

You'll need to add the commands you want to use in the appropriate places.

Just save this to a text file, chmod it to make it executable, then create a shortcut to launch it. Assuming no complications, that should do it.

angelo_maci 10-19-2010 12:24 PM

thank you for the trick but it is not useful now. I need a command to start a 3G connection that is already configured, say "broadband1", in ubuntu lucyd linx.


All times are GMT -5. The time now is 07:48 PM.