I am using putty to interact with Linux server. I have started a process using putty. The process is running and will take 5-6 hours. I want that process to keep running after I close the putty session. How can I keep that process alive after closing the putty session? I do not want to keep the computer ON all the time. Is there any way to do this?.
If you want the program that is contained in the process to always or frequently run in the background, you can code it to separate from the controlling terminal (make such behaviour controllable via an option flag) and run in the background.
That's a long term solution, of course, not for the currently running process.
How to keep weblogic running after closing putty window:
Simple Steps: after the login through putty follow the below steps:
- Go to the directory on the server where the
startWebLogic.shcommand is located.
- Type command
screenand press Enter (a new screen will open).
- In the new screen type your run command
- Press Ctrl+a then press d (without holding Ctrl); you will return back to the previous screen.
- When you want to return to your server log screen, type command
if the process is a for nodejs, and it may be your intention since you originally posted this on stackoverflow. I was originally searching for this question myself. I found pm2 and it is amazing. The other answers may help for general putty but if it is node specific this is by far the best answer, as there is built in monitoring and the setup is simply a
$ npm install pm2 -g $ cd yourappdirectory
"PM2 is a production process manager for Node.js applications with a built-in load balancer. It allows you to keep applications alive forever, to reload them without downtime and to facilitate common system admin tasks.
Starting an application in production mode is as easy as:"
$ pm2 start yourappname.js
"using the save and then freeze command you enable the processes to autostart on reboot"
$ pm2 save $ pm2 freeze
for monitoring its
$ pm2 monit
$ pm2 restart yourappname
also for direct logging information
$ pm2 logs
I now can easily run two putty windows instead of using my digialocean browser window (which I couldnt scroll up on); For more info see the main github