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?
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?
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.
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.
tmux
, another terminal multiplexer. It's very similar, but I prefer tmux to screen.