Running script in background?
If I wanted to run a script in the background and keep it running even if i close putty i do like
./perl.pl & right? |
That will run it in the background in the sense that you will get a new prompt.
If you want it to "survive" the terminal that you started it in (or putty in your case) you should start it with nohup ./perl.pl & or have a look at the screen command. |
Not quite. The script process will still be a child of your remotely open shell, so it will be terminated when you disconnect. A better solution is to use screen:
Code:
screen -S u ./perl.pl
Then you detach it (Ctrl-A, then Ctrl-D) and log out of the SSH session. To reattach it and see the results of your script you may log in to your remote server again and issue a command: Code:
screen -d -r u
|
Quote:
|
No problem :) Prehistoriks way (with the screen command) is more powerful and perhaps also more common. Its very convenient, especially when you're connected from a remote location. It sort of allows you to have several terminals (screens) in the same terminal.
The nohup (which comes from "no hangup", so you remember it ;)) is sort of neat in its simpleness though. |
All times are GMT -5. The time now is 12:21 AM. |