Welcome!
Important information
-- Spectre and Meltdown vulnerabilities
-- Change in MX sources

News
-- MX Linux on social media: here
-- Mepis support still here

Current releases
-- MX-17.1 Final release info here
-- antiX-17 release info here

New users
-- Please read this first, and don't forget to add system and hardware information to posts!
-- Here are the Forum Rules

exit terminal when script is done?

Here you can exchange scripts that you created or have permission to share with other users.
Message
Author
User avatar
GDixon
Forum Regular
Forum Regular
Posts: 358
Joined: Fri Nov 02, 2007 4:39 pm

Re: exit terminal when script is done? SOLVED

#11 Post by GDixon » Thu Jul 24, 2014 10:05 pm

In the morning i will give this a go.

Againg thank you for helping the feeble and simple mnded. This week my eyes have been crossing and my fingers have been making simple mistakes so i need to give it a rest.

My HP with the huge 15" screen is being rebuilt and i have it in pieces and so far i have decided a 10" aspire netbook helps in making typing errors :)

Question: what do you mean by calling it the same way or from the same place?

I normally just type the script in a terminal but would like to make a desktop link for some to just click on them and have them run. For now it's better to understand and have them work before doing more and then i can play some more.

Joany do you still use Firestarter and if you do is it still needed to make the change in it's config to make sure it don't look for the network connection too soon at boot?
Last edited by GDixon on Mon Oct 20, 2014 1:55 pm, edited 1 time in total.

User avatar
Adrian
Forum Veteran
Forum Veteran
Posts: 8914
Joined: Wed Jul 12, 2006 1:42 am

Re: exit terminal when script is done?

#12 Post by Adrian » Thu Jul 24, 2014 10:41 pm

You can call a script from a terminal, you can call it from another script, you can click on them to run if the Desktop Environment allows to run scripts (I think XFCE for example runs scripts but doesn't open a terminal window for them). Depending how you start the script it will have a different parent/grandparent, that's why is not a good idea to kill things blindly from a script.

User avatar
GDixon
Forum Regular
Forum Regular
Posts: 358
Joined: Fri Nov 02, 2007 4:39 pm

Re: exit terminal when script is done?

#13 Post by GDixon » Sat Oct 11, 2014 2:57 pm

Finally fat fingered it out and the simplist solution is to make it into a desktop Icon. Click the icon and the script runs when the script is done and you type q to quit the menu in the script the terminal closes.
I placed the desktop entry in /usr/local/bin with allmy other scripts and made a copy on the desktop.
Works as expected. Don't forget to make the desktop entry executable.

You can do this with any script I imagine but I tried it out with the ssd trim script and the wol script so far.

Code: Select all

[Desktop Entry]

Version=1.0

Name=Trim

Comment=To trim the ssd

Exec=/usr/local/bin/trim

Icon=/usr/share/icons/msystem.png

Terminal=true

Type=Application

Categories=Utility;Application;

User avatar
GDixon
Forum Regular
Forum Regular
Posts: 358
Joined: Fri Nov 02, 2007 4:39 pm

Re: exit terminal when script is done?

#14 Post by GDixon » Mon Oct 20, 2014 1:54 pm

Make a *.desktop file, I put it in the /usr/local/bin with my scripts. Make it a desktop icon and when you start the script from the desktop icon it will close the terminal after the script runs.
I forgot about doing it like this way back in m-3. something and it works still.

problem solved and it gets a nice launcher on the desktop with an icon.

yop
Forum Regular
Forum Regular
Posts: 152
Joined: Mon Sep 12, 2016 7:55 am

Re: exit terminal when script is done?

#15 Post by yop » Sat Oct 01, 2016 4:30 pm

make sure you dont kill init , if sourced ;-)

Post Reply

Return to “Scripts”