Results 1 to 7 of 7

Thread: double-click script/launcher, keep terminal open

  1. #1
    Join Date
    Jan 2009
    Beans
    45

    Arrow double-click script/launcher, keep terminal open

    I have an executable script: /home/myself/scripts/dostuff

    I have confirmed that running ./dostuff or 'sh dostuff' runs the script correctly.

    Now I want to place a launcher for the script on the desktop. I create a launcher with the command 'sh /home/myself/scripts/dostuff', and set it to run in a terminal and I add 'read' to the end of my script.

    However, when I run (by double-clicking on it) the script, the terminal doesn't stay up. It just flashes for a split nanosecond. What am I doing wrong?

  2. #2
    Join Date
    Jul 2009
    Location
    United Kingdom
    Beans
    124
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: double-click script/launcher, keep terminal open

    Show us the code first; so we can see what it does.

    Cheers

    pi4r0n

  3. #3
    Join Date
    Jan 2009
    Beans
    45

    Re: double-click script/launcher, keep terminal open

    ok.

    Code:
    dt="`date +den_%y%m%d.kl_%H:%M:%S`"
    echo "creating backup: $dt"
    tar -cf backup/"$dt" *.odt *.ods
    read
    It's a very simple backup script, archiving all ods and odt documents in tar-files with date stamps, from the folder it runs from. What's it doesn't do when I run it from a launcher is staying up so I can read if there are any errors. I've had similar problems before...

  4. #4
    Join Date
    Apr 2006
    Location
    Montana
    Beans
    Hidden!
    Distro
    Kubuntu Development Release

    Re: double-click script/launcher, keep terminal open

    You have to call the script to run in a terminal.

    Most terminals use -e , so ...

    Code:
    xterm -e "/path/to/your_script"
    There are two mistakes one can make along the road to truth...not going all the way, and not starting.
    --Prince Gautama Siddharta

    #ubuntuforums web interface

  5. #5
    Join Date
    Jun 2008
    Location
    California
    Beans
    2,271
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: double-click script/launcher, keep terminal open

    I have an alternate suggestion. It runs the script from a desktop launcher and leaves the terminal window open. I removed the read command from your script and used bash.

    Code:
    gnome-terminal --execute bash -c "/path/scriptname ; bash"
    Last edited by kaibob; November 24th, 2009 at 06:46 PM.

  6. #6
    Join Date
    Jan 2009
    Beans
    45

    Re: double-click script/launcher, keep terminal open

    Quote Originally Posted by kaibob View Post
    I have an alternate suggestion. It runs the script from a desktop launcher and leaves the terminal window open. I removed the read command from your script and used bash.

    Code:
    gnome-terminal --execute bash -c "/path/scriptname ; bash"
    Yes, that surely worked. I would have to include going to the folder that I wanted to make the backup from first though, since the script doesn't have absolute paths (in case anyone tries to reproduce).

    It's a bit strange that "run in terminal" doesn't work though. Shouldn't that do the same thing (running the script in the gnome-terminal)?

  7. #7
    Join Date
    May 2007
    Beans
    5

    Re: double-click script/launcher, keep terminal open

    Thank You so much!

    This has helped me make it easier for my coworkers (mostly ******* techies) to run the clonezilla server I set up for us to use!

    Clonezilla needs the terminal that launched it to stay open for the multicast clients to be able to start properly.

    I made a script called 'clonezilla.sh'

    Code:
    sudo /opt/drbl/sbin/dcs
    and a launcher with the following command:

    Code:
    gnome-terminal --execute bash -c "/path/to/clonezilla.sh ; bash"

Tags for this Thread

Bookmarks

Posting Permissions

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