Jump to content

Photo

Iconify and Bash question.


  • Please log in to reply
4 replies to this topic

#1 Norrolith

Norrolith

    Member

  • Members
  • 3 posts

Posted 29 March 2015 - 02:32 AM

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?





A big thank you to everyone who contributes to Bodhi Linux


#2 Duma

Duma

    Artist

  • Members
  • 2392 posts
  • LocationRivalta (TO) - Italia

Posted 29 March 2015 - 02:03 PM

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).
Se sei italiano e interessato a Linux, clicca qui!

#3 Norrolith

Norrolith

    Member

  • Members
  • 3 posts

Posted 29 March 2015 - 05:06 PM

Ah, is there a command to close the terminal to be run after that?
 



#4 ylee

ylee

    King of the Software Page

  • Moderators
  • 1510 posts
  • LocationSouth Carolina, USA

Posted 29 March 2015 - 05:34 PM

Just use the nohup command

nohup COMMAND >/dev/null 2>&1 & 

and you can kill the terminal afterwards but the command continues to execute ;)

"No technology can ever be too arcane or complicated for the black t-shirt crowd."


#5 sef

sef

    Bodhi Builder Wizard

  • Developer
  • 241 posts
  • LocationATL

Posted 30 March 2015 - 05:36 PM

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 &


<-sef>

Nothing is as simple as it seems at first,
or as hopeless as it seems in the middle,
or as finished as it seems in the end.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users