Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to resume stopped job on a remote machine given pid?

Tags:

linux

shell

I have a process on a machine which I stopped (with a Ctrl-Z). After ssh'ing onto the machine, how do I resume the process?

like image 358
Noel Yap Avatar asked Jul 25 '13 01:07

Noel Yap


People also ask

How do I start a stopped process?

When job control is active you can restart a suspended process. To restart a process with the stop command, you must first determine the JID by using the jobs command. You can then use the JID with the following commands: fg %JID Resume a stopped or background job in foreground.

Which command will resume a stopped job in the foreground?

If you have a suspended job that you'd like to resume running, first you must decide whether you want it running in the foreground, or the background. Find the job ID of the suspended job with the jobs command, and then use bg (to run the job in the background), or fg (to run the job in the foreground).

How do I continue a suspended job in Unix?

If you have just hit Ctrl Z , then to bring the job back just run fg with no arguments.

How do I resume a suspended Linux process?

You may be familiar with suspending a process that is running in the foreground by pressing CTRL-Z. It will suspend the process, until you type "fg", and the process will resume again.


1 Answers

You will need to find the PID and then issue kill -CONT <pid>.

You can find the PID by using ps with some options to produce extended output. Stopped jobs have a T in the STAT (or S) column.

If you succeed in continuing the process but it no longer has a controlling terminal (and it needs one) then it could possibly hang or go into a loop: just keep your eye on its CPU usage.

like image 116
Adrian Pronk Avatar answered Nov 18 '22 02:11

Adrian Pronk