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 need to create a script in Linux to get from server multiple files. After downloading files started need to close the session but without stopping the download.

How to do this?

Thanks

share|improve this question

migrated from stackoverflow.com Jan 5 '12 at 2:19

This question came from our site for professional and enthusiast programmers.

    
You can not download files without a session. You could do as aix suggests below but that just transfers the session to a different non-interface session it still needs an ftp connection (session). –  Bueller Jan 4 '12 at 18:12
add comment

2 Answers 2

If what you mean is to continue downloading files in the background after you exit your login session what you need is nohup.

For example:

$ nohup download-script &
$ exit

counting on that you created download-script containing your commands.

share|improve this answer
add comment

You can use the screen command to create a "screen" session on your machine. Screen is a full-screen window manager that multiplexes a physical terminal between several processes (typically interactive shells). Screens can be detached while leaving the background processes running, and then later re-attached if you wish. This allows you to close a terminal window or close a session without losing your processes. This is especially useful if you need to leave something running for a long period of time or have a temperamental connection to your server.

Run man screen to see how to use it. (hint: It's painfully simple)

Alternatively, if you simply need to run a process or script in the background, but don't want to keep a "session" open, consider using:

progname [arguments] &

Any command terminated with & will execute in the background. Of course this implies that your program doesn't require user intervention.

share|improve this answer
    
You could also install and try tmux, another terminal multiplexer. It's very similar, but I prefer tmux to screen. –  Rob Jan 5 '12 at 20:23
add comment

Your Answer

 
discard

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