Is there a way to pause a running process on Linux systems and resume later?

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

Assuming your workload is a single process (doesn't fork helpers running in background), you can use something like this:

# start copy in background, store pid
cp src dst &
echo "$!" >/var/run/bigcopy.pid

Then when busy time starts, send it a SIGSTOP:

# pause execution of bigcopy
kill -STOP "$(cat /var/run/bigcopy.pid)"

Later on, when the server is idle again, resume it.

# resume execution of bigcopy
kill -CONT "$(cat /var/run/bigcopy.pid)"

You will need to schedule this for specific times when you want it executed, you can use tools such as cron or systemd timers (or a variety of other similar tools) to get this scheduled. Instead of scheduling based on a time interval, you might choose to monitor the server (perhaps looking at load average, cpu usage or activity from server logs) to make a decision of when to pause/resume the copy.

You also need to manage the PID file (if you use one), make sure your copy is actually still running before pausing it, probably you'll want to clean up by removing the pidfile once the copy is finished, etc.

In other words, you need more around this to make a reliable, but the base idea of using these SIGSTOP and SIGCONT signals to pause/resume execution of a process seems to be what you're looking for.


Instead of suspending the process, you could also give it lower priority:

renice 19 "$pid"

will give it the lowest priority (highest niceness), so that process will yield the CPU to other processes that need it most of the time.

On Linux, the same can be done with I/O with ionice:

ionice -c idle -p "$pid"

Will put the process in the "idle" class, so that it will only get disk time when no other program has asked for disk I/O for a defined grace period.


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>