Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to pause the make process and resume later?

I would like to pause this build process , shutdown my laptop and sleep for a while and resume later.Now I've found a linux command 'fg' that could work for me. But i'm not sure of how it's used and whether it will work in my case( i want to pause 'make' and shutdown my system).

Thanks in advance

like image 581
SloppyJoe Avatar asked Feb 06 '16 12:02

SloppyJoe


People also ask

Is it possible to pause a process?

You can pause execution of a process by sending it a SIGSTOP signal and then later resume it by sending it a SIGCONT .

How do you suspend a process and resume it later in Linux?

First, find the pid of the running process using ps command. Then, pause it using kill -STOP <PID> , and then hibernate your system. Resume your system and resume the stopped process using command kill -CONT <PID> .

How do you pause in Makefile?

Use ctrl -S for halting display, and ctrl -Q for resuming. You don't need to modify your Makefile.

Which signal is used to resume a paused process?

The SIGSTOP and SIGCONT signals suspend and resume a process, respectively.


2 Answers

First of all, makefiles are intended, almost, to do what you want: they should build only the missing or not up-to-date parts of a project. So, if you have a project made by 100 files, and start the build process, and after compilation of 50 files the build gets interrupted, on the next build invocation the process should restart, more or less, from where it was interrupted. This happens if the makefile is written well, and nobody issues a "make clean", of course.

Then you talk about the fg command, but its purpose is different from what you want: if you shutdown your computer, all the programs get stopped (and will not restart automatically). May be you can hibernate your laptop and, if yes, you don't need any further precautions.

like image 162
linuxfan says Reinstate Monica Avatar answered Nov 23 '22 23:11

linuxfan says Reinstate Monica


Assuming you want to send a SIGINT to interrupt the process, the short answer is it depends on the process. For example, it's totally possible to stop an rsync process then resume it later. In order to stop a process then continue where you left off, you'd need a mechanism to store the last state the process was in.

like image 24
Shammel Lee Avatar answered Nov 23 '22 23:11

Shammel Lee