Results 1 to 2 of 2

Thread: how go run command from file .desktop for super root?

  1. #1

    Default how go run command from file .desktop for super root?

    hello

    i want to create a file .desktop for me personally then you see my code, i will wanted to free (clear) cache in memory
    use comand:
    su
    [password root]
    echo 1 > /proc/sys/vm/drop_caches
    this is worked to clear cache in memory
    then i create .desktop for me:
    [Desktop Entry]
    Comment[it]=
    Comment=
    Exec=su echo > 1 /proc/sys/vm/drop_caches
    GenericName[it]=
    GenericName=
    Icon=media-flash
    MimeType=
    Name[it]=
    Name=
    Path=
    StartupNotify=true
    Terminal=false
    TerminalOptions=
    Type=Application
    X-DBUS-ServiceName=
    X-DBUS-StartupType=
    X-KDE-SubstituteUID=false
    X-KDE-Username=
    this not worked... where i'm wrong code?
    or file .sh? it's can work?

    thank you

  2. #2
    Join Date
    Mar 2010
    Location
    Austin - Texas
    Posts
    10,140
    Blog Entries
    48

    Smile Re: how go run command from file .desktop for super root?

    Quote Originally Posted by manuel_songokuh View Post
    hello

    i want to create a file .desktop for me personally then you see my code, i will wanted to free (clear) cache in memory
    use comand:

    this is worked to clear cache in memory
    then i create .desktop for me:

    this not worked... where i'm wrong code?
    or file .sh? it's can work?

    thank you
    See if the following bash script works for you. Copy the text from the following code field and save it in your local bin folder as $HOME/bin/vmfix

    Code:
    #!/bin/bash
    
    #: Title       : vmfix
    #: Date Created: Sat Aug 17 18:46:47 CDT 2013
    #: Last Edit   : Sat Aug 17 18:46:47 CDT 2013
    #: Author      : https://forums.opensuse.org/members/manuel_songokuh.html
    #: Version     : 1.00
    #: Description : 
    #: Options     : 
    
    # *****************************************************************************
    #                Check to see if vmfix was started as Root 
    # *****************************************************************************
    
    function check_uid {
      if [ $UID != 0 ] ; then
        clear
        echo -n "vmfix Requires Root User Authority.  Please Enter "
        sudo $0
        Exit_Command=$?
      else
        clear
        echo -n "Executing the command: echo > 1 /proc/sys/vm/drop_caches"
      fi
      return 0
    }
    
    check_uid
    
    echo > 1 /proc/sys/vm/drop_caches
    
    exit 0
    
    # End Of Script
    To use it, it must be marked as executable with this terminal command:

    Code:
    chmod +x $HOME/bin/vmfix
    To test, from the same terminal session just type in:

    Code:
    vmfix
    You could then use the following $HOME/Desktop/VM-FIX.desktop file:

    Code:
    [Desktop Entry]
    Comment[en_US]=
    Comment=
    Exec=$HOME/bin/vmfix
    GenericName[en_US]=VM Fix
    GenericName=VM Fix
    Icon=yast-vm-install
    MimeType=
    Name[en_US]=VM-FIX
    Name=VM-FIX
    Path=
    StartupNotify=false
    Terminal=true
    TerminalOptions=
    Type=Application
    X-DBUS-ServiceName=
    X-DBUS-StartupType=none
    X-KDE-SubstituteUID=false
    X-KDE-Username=
    Thank You,
    My Blog: https://forums.opensuse.org/blogs/jdmcdaniel3/

    Software efficiency halves every 18 months, thus compensating for Moore's Law

    Its James again from Austin, Texas

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •