LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   run something not attached to xterm (https://www.linuxquestions.org/questions/linux-newbie-8/run-something-not-attached-to-xterm-817035/)

JoeJoe 06-29-2010 02:15 PM

run something not attached to xterm
 
I prepared this small script, its like this


#!/bin/bash
#restart the stuck firefox

killall firefox
sleep 5
firefox
done

it fires firefox but it doesn't ends before I close firefox,

What I want it to do is this script to fire up a firefox and close itself, I want firefox to keep running even if I close that xterm, just like firefox started from gnome panel.

I would also love if someone explains what actually happens when i click firefox icon from gnome, does it run unattached or does it run attached to tty7 or tty1 ?

jrtayloriv 06-29-2010 02:26 PM

Do
Code:

nohup firefox
instead of
Code:

firefox
... this will prevent it from closing firefox when you close the terminal.

See man nohup for more details

smoker 06-29-2010 02:28 PM

firefox &

Or if this is on fedora, and firefox is the default browser, you can run htmlview which is a helper program.
Try opening a terminal and running htmlview and see what happens.

JoeJoe 06-29-2010 02:51 PM

nohup got the job done, is there anything I should know about it, is it secure use on a server for other purposes,

edit: it didn't worked as I wanted on script, still after execution of firefox script stands still, it doesn't ends,


is it possible to pass an command to gnome "Run Application" (alt-f2) from a shell?

jrtayloriv 06-29-2010 03:40 PM

Code:

nohup firefox &

JoeJoe 06-30-2010 01:27 AM

"nohup firefox &" got the job done

JoeJoe 06-30-2010 02:36 AM

pass a command to gnome "Run Application"
 
is it possible to pass a command to gnome "Run Application" from a shell?

alli_yas 06-30-2010 03:45 AM

Hi JoeJoe,

Not sure what you mean - do you mean initialize a GNOME/GUI session from a terminal session? If that's the case CTRL-ALT-F7 will do this in Fedora/RHEL/CentOS.

Alternately, from a terminal session issuing the following command will startup a GUisession:

Code:

# init 5

JoeJoe 06-30-2010 04:27 AM

The thingy which opens with alt+f2 at gnome, the run application dialog, can I pass a command to it from a terminal?

i92guboj 06-30-2010 05:23 AM

Quote:

Originally Posted by JoeJoe (Post 4019123)
The thingy which opens with alt+f2 at gnome, the run application dialog, can I pass a command to it from a terminal?

I am not sure what are you exactly trying to do.

If you want to run, let's say, firefox from a terminal, why not just launch "firefox" from the command line instead of using that toy in the middle?

alli_yas 06-30-2010 06:06 AM

Quote:

If you want to run, let's say, firefox from a terminal, why not just launch "firefox" from the command line instead of using that toy in the middle?
Exactly - if you wish to run an application; you don't need a "Run" dialog - from the terminal you can execute the binary which will run the application.

JoeJoe 06-30-2010 06:38 AM

i need the software to run exacly as I clicked it from GUI, independently,without a terminal hanging around the screen (ps: nohup doesn't works in my target PC,)

colucix 06-30-2010 07:41 AM

Quote:

Originally Posted by JoeJoe (Post 4019240)
i need the software to run exacly as I clicked it from GUI, independently,without a terminal hanging around the screen (ps: nohup doesn't works in my target PC,)

You may try disown:
Code:

$ xclock &
[1] 9982
$ disown $!
$ exit <closed terminal, xclock still running, hopefully...>


Drakeo 06-30-2010 07:54 AM

I just run
Quote:

firefox & exit
works fine for me.

alli_yas 06-30-2010 08:04 AM

Hi

You can also run in a screen:

Code:

# screen
# xclock

After doing the above the xclock should be running. Thereafter you hit CTRL+A+D and this will detach you from the screen with the xclock still running. Exiting the terminal should leave the xclock still running.


All times are GMT -5. The time now is 07:42 AM.