Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I ssh from my MacBook to a remote Linux and started a lengthy script (import 2000000+ lines of csv text records into MySQL). Too bad I have to take away my MacBook one hour later.

How can I keep the script running when I unplug my MacBook?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Use nohup and run your process in the background. Run your process like this:

nohup command &

Edit:
To nohup running processes: press ctrl+z, enter "bg" and enter "disown"

share|improve this answer
    
for my case, I have already started the script, is there something I can do now? Thanks –  ohho Oct 13 '10 at 4:51
1  
Found a solution on nohup wikipedia. To nohup running processes: press ctrl+z, enter "bg" and enter "disown". –  ohho Oct 13 '10 at 4:58

nohup is fine, but spartian. screen is powerful. Let's do:

screen
command

type Control-A, then d. This will detach the screen session. You'll see the detached session with:

screen -ls

To reattach a session:

screen -r

See also this screen presentation

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.