4

I often have to run the update manager on a slow connection, and while reading my emails, I meanwhile would like to surf for 2 minutes in the web, then have the full bandwidth again for the update manager.

From the command line, I can suspend a running process with Ctrl+Z, aka suspend. But if I didn't start the program from the shell - can I do it with some signal and the kill command?

I read the man page for signal (man -a signal), but there I didn't find a SIGSUSPEND, only SIGSTOP, SIGTERM, SIGINT and such - which is appropriate, or is there none?

user unknown
  • 6,447
  • 3
  • 34
  • 63

1 Answers1

5

For the general case you can stop (suspend a process or process group as below):

Control-Z is
kill pidnumber -SIGSTOP
to continue:
kill pidnumber -SIGCONT

Alternatively, to suspend an entire process group:
kill -groupnumber -SIGSTOP
and
kill -groupnumber -SIGCONT

Of course if you suspend a process with some element that is timed, it may not continue properly. In the use case mentioned, the repository server is timing data transfer acknowledgments, it can time-out the transfer because your client has 'gone away' or slow it down because there is 'network congestion'.

I certainly wouldn't suspend update-manager while it was updating my packages, either.

John S Gruber
  • 13,248
  • 3
  • 37
  • 64
  • Thanks for asking. I had never tried this before, but it sure works for me. From a signal point of view control-Z _"stops"_ a process. – John S Gruber May 19 '12 at 04:17
  • Thanks. It deactivates the window, but the download seems unaffected - it's continuing in the background, so I don't solve the underlying problem, but it will be useful in other situations. – user unknown May 19 '12 at 10:40
  • I'm not sure it is, generally speaking, a good idea to suspend update-manager anyway. I don't think you want to run a system for an extended time with packages half-installed. If you cancel during the cache update or package download and start it back up soon after it will start close to where it left off. – John S Gruber May 19 '12 at 14:59
  • The update manager has a cancel button, so you can cancel the progress altoghether, but it doesn't remember which package you selected. For instance the 3 biggest packages which are downloaded, where I interrupted the process are adobe acrobat, which I only use sometimes to veryfy self produced PDFs for a client, who will read them on Windows clients with adobe software, so I'm surely not vulnerable to these PDFs. Second: Kernel source, which I hadn't a look into for years, and opera, which I only use to compare self produced html to output in firefox. When the packages aren't completl down- – user unknown May 19 '12 at 17:33
  • -loaded, they aren't installed. There is no half-installed, since I only want to interrupt the download, before installation starts. But a 60 MB download can take several hours - I don't want to lose the time, if already 20 MB where downloaded in 2 hours. – user unknown May 19 '12 at 17:36
  • I think package downloads should be mostly restartable. Not so apt-get update after running more than 30 minutes. – John S Gruber May 19 '12 at 19:21