Way to pause a running process on Linux systems and resume later

processprocess-management

I have to copy files on a machine. And the data is immensely large. Now servers need to serve normally, and there are usually a particular range of busy hours on those.
So is there a way to run such commands in a way that if server hits busy hours, it pauses process, and when it gets out of that range, it resumes it?

Intended-Result

cp src dst

if time between 9:00-14:00 pause process
After 14:00 resume cp command.

Best Answer

Yes, you need to acquire the process id of the process to pause (via the ps command), then do:

$> kill -SIGSTOP <pid>

The process will then show up with Status "T" (in ps).

To continue, do a:

$> kill -CONT <pid>
Related Question