How To Suspend A Process And Resume It Later In Linux

Suspend A Process And Resume It Later In Linux

3 Responses

  1. Paul Grunwald says:

    you should add the following:

    : suspend the process
    bg : run the suspended process in the background
    fg : bring the background process to the forground

  2. Mallika says:

    >To verify it if the process is running, run ps command.

    This doesn’t verify that it is running, since the Stopped message only shows up once, as far as I can tell.

    I say this, because when I try to -CONT this STOPPED process,
    it immediately reports that it got stopped, rt?

    [[email protected] see-initrd]£ kill -CONT 8745
    [[email protected] see-initrd]£ ps
    PID TTY TIME CMD
    7569 pts/0 00:00:00 sudo
    7572 pts/0 00:00:00 bash
    8745 pts/0 00:00:00 cpio
    10529 pts/0 00:00:00 ps

    [1]+ Stopped cpio –extract –no-absolute-filenames initramfs-3.10.0-957.27.2.el7.x86_64 (wd: /home/mallikab/see-initramfs)
    (wd now: /home/mallikab/see-initrd)

    Running ps now, even though it says nothing about Stopped, doesn’t indicate that the process is running:
    [[email protected] see-initrd]£ ps
    PID TTY TIME CMD
    7569 pts/0 00:00:00 sudo
    7572 pts/0 00:00:00 bash
    8745 pts/0 00:00:00 cpio
    10568 pts/0 00:00:00 ps

    You can confirm it wasn’t running, because issuing a -STOP on a stopped process, produces no ‘Stopped’ messaging:
    [[email protected] see-initrd]£ kill -STOP 8745
    [[email protected] see-initrd]£ ps
    PID TTY TIME CMD
    7569 pts/0 00:00:00 sudo
    7572 pts/0 00:00:00 bash
    8745 pts/0 00:00:00 cpio
    10746 pts/0 00:00:00 ps
    [[email protected] see-initrd]£

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.