Announcement

Collapse
No announcement yet.

activate a shell script with a desktop link?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    activate a shell script with a desktop link?

    Desktop: Kubuntu, Version: 7.04 Feisty Fawn
    ************************************

    Hi,

    I would like to run a shell script using a desktop link to that script, avoiding to open a terminal and to type the command. However, being rather new to Linux/Kubuntu, till now this fails. How can I do it?

    Background
    ---------------

    The script I created is /usr/local/sbin/downUpWLAN:

    #!/bin/bash

    sudo ifdown wlan0
    sleep 30
    sudo ifup wlan0

    exit 0
    It is executable:
    -rwxr-xr-x 1 root root 55 2007-08-08 21:31 downUpWLAN
    In sudoers, I did set access rights to downUpWLAN for all users (last line) using "sudo visudo":
    #
    /etc/sudoers
    #
    # This file MUST be edited with the 'visudo' command as root.
    #
    # See the man page for details on how to write a sudoers file.
    # Host alias specification

    # User alias specification

    # Cmnd alias specification

    # Defaults

    Defaults !lecture,tty_tickets,!fqdn

    # User privilege specification
    root ALL=(ALL) ALL

    # Members of the admin group may gain root privileges
    %admin ALL=(ALL) ALL

    # All users may run downUpWLAN
    %users ALL=NOPASSWD: /usr/local/sbin/downUpWLAN
    If I type in a terminal "downUpWLAN", the script works beatuifully:
    * I have to type in my log-in password
    * then ifdown wlan0 starts, outputs messages
    * after 30 seconds ifup wlan0 starts, outputs messages
    * now my wireless internetconnection is active, if it wasn't before

    The problem
    ---------------

    If I place a link from downUpWLAN to my Desktop using
    <Alt>+<F2>kdesu konqueror

    ...nothing happens if I klick this link. No demand for the password, no message output, no network activation. However, when I put a line into downUpWLAN such:

    echo Hello >> /<path to my desktop>/output.txt
    the file output.txt. is created on my desktop. Thus, linking works for a text output. But how can I get the commands "sudo ifdown wlan0" and "sudo ifup wlan0" to work?

    Any suggestions, please?

    Case somebody wants to know
    ---------------------------------------
    I connect to the internet wirelessly with AVM Fritz!Stick USB/Fritz!Box WLAN. The connection is steady and runs smoothly, once established. But most often, first I have to use the two "ifdown..." "ifup..." commands after a start or reboot. I want to stick to this routine for some time to better get to know my system and learn some scripting on the way.

    Thanks,

    Siggi



    #2
    Re: activate a shell script with a desktop link?

    # For one script in particular:

    From Konqueror, "drag & drop" the script file to the panel, fill in the form popping-up thereupon, select "Run in terminal" - and that's it

    # For scripts "per se": http://www.penguin.ch/dokuwiki/doku....ciated_console

    Comment


      #3
      Re: activate a shell script with a desktop link?

      Originally posted by UnicornRider
      # For one script in particular:

      From Konqueror, "drag & drop" the script file to the panel, fill in the form popping-up thereupon, select "Run in terminal" - and that's it

      # For scripts "per se": http://www.penguin.ch/dokuwiki/doku....ciated_console
      Thanks! Great answer!

      siggi

      Comment


        #4
        Re: activate a shell script with a desktop link?

        or you can create a "*.desktop" file that opens "sh /PathToScript/script"

        Have a nice day
        Join the dark side<br />---------------------------------------------------------------------<br />Samsung NC10 netbook running<br />PCLinuxOS 2010 // Win XP

        Comment


          #5
          Re: activate a shell script with a desktop link?

          Originally posted by UnicornRider
          # For one script in particular:

          From Konqueror, "drag & drop" the script file to the panel, fill in the form popping-up thereupon, select "Run in terminal" - and that's it

          # For scripts "per se": http://www.penguin.ch/dokuwiki/doku....ciated_console
          Sorry, nothing like this is popping up! The only choices I have are

          * Copy
          * Link
          * Escape

          I tried both "konqueror" and "kdesu konqueror", to no avail!

          What is going wrong, please?

          Comment


            #6
            Re: activate a shell script with a desktop link?

            Originally posted by Gediminas2
            or you can create a "*.desktop" file that opens "sh /PathToScript/script"

            Have a nice day
            Terrific! I ended up on my desktop with a blue cogwheel that does exactly what I want. Thanks

            Being pretty much a newbie it took quite some trial and error to advance from a simple textfile to a link to an application. Learned quite something!

            have a nice evening if you are this side of the ocean

            Comment

            Working...
            X