11

Using bash, one can pause a process with control-z. However, are there any general circumstances or guidelines to beware of where a process would not behave well with being paused?

My specific scenario was in creating a tar file that was taking longer than expected. I wanted to pause it to put it in the background, but decided not to. My question isn't, of course, specific to tar. Rather, I'm hoping to understand the pausing feature in bash a bit better as well as what would make a process react poorly to being paused.

4 Answers 4

6

If your process is writing out data, just be aware that timing issues with non-random access devices and buffers may be problematic. I've seen tape drives have issues with this at times.

4
  • network / firewall sessions may time out and not be restarted because TCP-SYN not being resent.
    – jippie
    May 25, 2012 at 6:55
  • The TCP stack would continue sending ACKs that the window is full though, right?
    – Magellan
    May 25, 2012 at 15:55
  • Keep alive packets is not part of the TCP nor the IP protocol, at best it is part of the application. So a firewall or a remote client or server may timeout waiting for a packet and drop the socket/connection.
    – jippie
    May 25, 2012 at 17:08
  • Not speaking to keepalives, those are obviously Application level. I'm talking about ACKs for the TCP sliding window at the Transport level.
    – Magellan
    May 25, 2012 at 20:01
3

Storage tasks (pvmove, veritas vx-whatever) that rely on atomic copies. It is not good if they get stuck outside of their control. It depends on whether the task just fires off some API and does the rest from kernel space, then it's safe. If it's happening in that *process* in your shell, then really go with screen and keep hands off.

Definitely recommend you to avoid stopping them to background. Commands that use buffers like dd seem to be better off, with the exception of the tape drives mentioned above.

(I once won an additional reboot, less sleep and a lot of paranoia when that happened to me while clearing up other people's mess. obviously: don't try taking shortcuts if you're fixing other peoples shortcuts...)

2

And the mundane scenario: doing Ctrl-Z, then forgetting about it and logging off, and losing the process! =)

0

Not really a specific answer to the question, but alternatively, you could attempt to run concurrent jobs using screen. You can thus use the shell concurrently with another program.

2
  • Yes, screen is always a good way to go. I am not sure how to respond to your name, however.
    – Wesley
    May 25, 2012 at 5:18
  • @toiletfreak How is screen an alternative to pausing? Screen runs a job in the background right? But it continues if you detach the screen...
    – Bernhard
    May 25, 2012 at 5:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.