Really quick Unix question....

gopunk

Lifer
Jul 7, 2001
29,239
2
0
what's the command to run a job not connected to your terminal? i.e., after you log off it still runs...

i know there is screen, but there is something else too...
 

Entity

Lifer
Oct 11, 1999
10,090
0
0
Cron to run jobs at a later time/date.

Screen for starting a job, detatching it, then logging out.

Rob
 

gopunk

Lifer
Jul 7, 2001
29,239
2
0
thanks guys... i mean one that will start the job immediately... i heard another guy mention it at school, it wasn't cron or at...
 

Beattie

Golden Member
Sep 6, 2001
1,774
0
0
& ?

that forces the process into the background so that you can still work on the terminal... like

# mozilla &

Also, you can use CTRL-Z then bg to make a foreground process run in the background. and then fg to bring it forward.

 

gopunk

Lifer
Jul 7, 2001
29,239
2
0
NOHUP

i think that's what i was looking for... thanks! oh yea and the & stuff works too... i dunno why i thought it wouldn't... probably because whenever i use it with emacs and i close the terminal, emacs dies
 

atom

Diamond Member
Oct 18, 1999
4,722
0
0
Eh, you sure & works? & only put things into the background, when you log off your terminal it will kill all your processes.
 

gopunk

Lifer
Jul 7, 2001
29,239
2
0
Originally posted by: atom
Eh, you sure & works? & only put things into the background, when you log off your terminal it will kill all your processes.

yea for some weird reason it does... that's what i thought too

i dunno how to get it back though... i can see in top but i dunno how to resume it (bg doesn't show it)...

how do you get it back if you use nohup? or do you just have to look at nohup.out and kill the process if you don't want it anymore...
 

gopunk

Lifer
Jul 7, 2001
29,239
2
0
Originally posted by: Bootprint
If the job is in the background use jobs and fg.

fg doesn't show anything and jobs doesn't either... but the process shows up in top. hmmmmm
 

gopunk

Lifer
Jul 7, 2001
29,239
2
0
Originally posted by: Pepsi90919
i thought you said it wasn't running?

no it is running, i just have no idea how to get back to it... bring it to the foreground
 

ys

Senior member
Oct 10, 1999
757
0
0
Originally posted by: gopunk
NOHUP

i think that's what i was looking for... thanks! oh yea and the & stuff works too... i dunno why i thought it wouldn't... probably because whenever i use it with emacs and i close the terminal, emacs dies

You can do disown emacs from the terminal.
$emacs &
$disown emacs
or just do "emacs & disown"

I don't know if that answers your original question though...

 

atom

Diamond Member
Oct 18, 1999
4,722
0
0
You can also run the process in a subshell and I don't think it will kill it when you log out of your current session. Also, you can configure your shell to not kill background processes when you log out, although I don't think this is that great of an idea personally.

As far bringing back a process to foreground after using nohup, I have no clue.
 

Nitemare

Lifer
Feb 8, 2001
35,461
4
81
Originally posted by: gopunk
Originally posted by: atom
Eh, you sure & works? & only put things into the background, when you log off your terminal it will kill all your processes.

yea for some weird reason it does... that's what i thought too

i dunno how to get it back though... i can see in top but i dunno how to resume it (bg doesn't show it)...

how do you get it back if you use nohup? or do you just have to look at nohup.out and kill the process if you don't want it anymore...

ps "project name"

kill -9 "process number"