mike@krusty:~$ pidof ffmpeg 22730 mike@krusty:~$ sudo kill -STOP 22730 [sudo] password for mike: mike@krusty:~$ sudo kill -CONT 22730
Holy crap, how come it took so long for me to figure out you can pause a running process in Linux and restart it later? I was looking at the manual page for the kill command (man kill) when I started wondering what the CONT option is used for. It turns out that it is paired with the STOP option (and a couple of others) which can be used to pause a running process. Here’s a quick rundown of the process:
- Find the PID of the process using the ‘pidof’ command
- Pause the process using that PID (22730 for example): sudo kill -STOP 22730
- Go about your business
- Restart the process when you’re ready: sudo kill -CONT 22730
What can you use this for? Well, if you’re doing something processor intensive, like transcoding video, you might want to regain your CPU power for a quick task. This lets you do that.
Certainly useful, but usually if you have the programs stdI/O open, a ^Z would accomplish this in a much neater way (If I’m not mistaken) – you can resume by typing either ‘bg’ for running it in the background without the stdI/O or ‘fg’ to get it back
You’re right. But I have a lot of automated processes, like automatic transcoding of over-the-air television shows. If I want to play Portal 2 on Steam running under Wine (processor intensive) it’s nice to be able to pause FFMPEG and start it back up again once I’m done gaming.
True that, it certainly has it’s uses. Especially if you don’t have the stdout available somewhere – like you usually do not when it’s a background job.