Results 1 to 3 of 3

Thread: Pause a program in terminal

  1. #1
    Join Date
    May 2024

    Pause a program in terminal

    I want to pause a program in terminal, not the way of hitting ctrl+z or ctrl+s, that only can make the program run in backgroud or stop output (I can see a program using internet). I want it be like ctrl+p to VMs in VBox, everything inside the window is frozen, after hitting ctrl+p, everything start running.

  2. #2
    Join Date
    May 2024

    Re: Pause a program in terminal

    You can use docker pause, which uses freezer cgroups

  3. #3
    Join Date
    Mar 2010

    Re: Pause a program in terminal

    Most hypervisors have a "suspend" option on the "Start/Shutdown" menu.

    In virsh, the manpage says:
    VIRSH(1)                           Virtualization Support                           VIRSH(1)
           virsh - management user interface
           virsh [OPTION]... [COMMAND_STRING]
           virsh [OPTION]... COMMAND [ARG]...
           The virsh program is the main interface for managing virsh guest domains. The program
           can be used to create, pause, and shutdown domains. It can also be used to list  cur‐
           rent domains. Libvirt is a C toolkit to interact with the virtualization capabilities
           of recent versions of Linux (and other OSes). It is free software available under the
           GNU Lesser General Public License. Virtualization of the Linux Operating System means
           the ability to run multiple instances of Operating Systems concurrently on  a  single
           hardware system where the basic resources are driven by a Linux instance. The library
           aims at providing a long term stable C API.  It currently supports  Xen,  QEMU,  KVM,
           LXC, OpenVZ, VirtualBox and VMware ESX.
           The basic structure of most virsh usage is:
              virsh [OPTION]... <command> <domain> [ARG]...
              suspend domain
           Suspend a running domain. It is kept in memory but won't be scheduled anymore.
              nodesuspend [target] [duration]
           Puts  the  node (host machine) into a system-wide sleep state and schedule the node's
           Real-Time-Clock interrupt to resume the node after the time duration specified by du‐
           ration is out.  target specifies the state to which the host will be suspended to, it
           can be "mem" (suspend to RAM), "disk" (suspend to disk), or "hybrid" (suspend to both
           RAM  and  disk).   duration specifies the time duration in seconds for which the host
           has to be suspended, it should be at least 60 seconds.
           • paused
             The domain has been paused, usually occurring  through  the  administrator  running
             virsh  suspend.  When in a paused state the domain will still consume allocated re‐
             sources like memory, but will not be eligible for scheduling by the hypervisor.
           • pmsuspended
             The  domain  has  been  suspended  by  guest power management, e.g. entered into s3
           Normally only active domains are listed. To list inactive domains specify  --inactive
           or --all to list both active and inactive domains.
    So, from any terminal, you can use
    $ virsh suspend regulus
    to suspend the regulus virtual machine. virsh is part of the libvirt tools, so any of the hypervisors supported would work.

    For LXC containers, check the manpages for how to suspend them. I'd guess "stop" would be the command option.

    To my knowledge, there's no way to have a tree of processes stopped, like you seem to want. They need to be grouped, somehow. That would be inside a VM or a Container.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts