Jump to content
  • 0
Norrolith

Iconify and Bash question.

Question

Okay so I am wanting to use a bash script to run a process.

The problem is I don't want the terminal hanging around and closing the terminal kill the process.

I was experimenting around and discovered Iconify seems to make it go away.

I am guessing from the name though that it is now an Icon somewhere.
So in short my question is, How can I make a script run without a terminal, or maybe Iconify the terminal.
How would you approach this issue?

Share this post


Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0

I don't know if it's what you need, but in a terminal if you launch

COMMAND &
you can close the terminal without problem and the program launched by COMMAND runs indipendently.

for example:

galculator
in a terminal launch the calculator, but if you close the terminal, you'll kill the calcolator too.

galculator &
you give as output on terminal the ID of the process (so you can kill it in a terminal with
kill ID
and you teerminal will be free for other commands (or to be closed).
  • Like 1

Share this post


Link to post
Share on other sites
  • 0

Just use the nohup command

nohup COMMAND >/dev/null 2>&1 & 
and you can kill the terminal afterwards but the command continues to execute ;)
  • Like 1

Share this post


Link to post
Share on other sites
  • 0

If you are running a script, you don't need a terminal to open or start a process, unless you need the process to run inside the terminal.

 

If you need the process to run inside the terminal, you will probably need some manual intervention to close the terminal. Most terms will allow you to execute a command by issuing some option like '-e command ' along with the command to open the terminal. Check the man page for the terminal. For example, I can issue 'gnome-terminal -e nmon' inside a terminal (or script) and it will pop up the gnome-terminal and start the process nmon, but (to my best knowledge) I will have to close the new terminal manually.

 

In the script, you can do this to run the process/command so that the script will wait for it to close/complete before continuing:

command  -or-  eval command

Or, if you want the script to continue without waiting for the process/command to close/complete:

command &  -or-  eval command &

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×