I've a background process running in Mac terminal
./scripts/start_emulator &
[1] 37194
After executing several steps, it automatically gets suspended with following message
Accept? (y/N):
[1] 37194 suspended (tty input) ./scripts/start_emulator
How do I resume / continue this suspended process?
CodePudding user response:
A process running in background [as commanded with &
at the end] gets suspended while it is waiting for the input.
Indicator:
suspended (tty input)
In order to resume that suspended process, enter
fg
This brings the background process to the foreground & then enter the input, in my case
y
The normal process execution should resume in foreground.
CodePudding user response:
To add to the Chaitanya Bapats answer,
you can use jobs
command to list the suspended jobs. The output will be something like this if you have more than one suspended jobs.
[1] - suspended sleep 400
[2] suspended sleep 300
You can bring the job to foreground by using fg
. If you have more than one suspended jobs, then you can use fg %ID
. ID is the value inside []
in the output of jobs
command.
Also, if you want to resume the job without bringing it to the foreground, you can use kill -CONT
command. Example usage:
kill -CONT JOBID
You can also use bg
command to move job to background. bg
will resume the last suspended job. Also, bg %ID
will resume the job with [ID]
in jobs command output