0

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 do I do this?

1
  • 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, 2012 at 18:12

2 Answers 2

1

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.

0

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.

1
  • You could also install and try tmux, another terminal multiplexer. It's very similar, but I prefer tmux to screen.
    – Rob
    Jan 5, 2012 at 20:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .