MASS - Starting and Stopping¶
Stopping Containers¶
SSH into Proxmox Server: First, you need to SSH into your Proxmox server or access its command line through the console.
List All Running Containers: Use the command pct list to list all running containers. This will give you the IDs of the containers.
Stop Containers: To stop multiple containers, you can use a bash loop. For example:
for id in {101..110}; do pct stop $id; done
This command stops containers with IDs from 101 to 110. Adjust the range according to your container IDs.
Starting Containers¶
List All Stopped Containers: If needed, you can list all stopped containers using a command like pct list | grep stopped to identify which ones are not running.
Start Containers: Similarly, to start multiple containers, use a bash loop:
for id in {101..110}; do pct start $id; done
This will start containers with IDs from 101 to 110.
Note:¶
If container IDs are not in a continuous sequence (they jump from 204 to 300, then to 400), you'll need to handle each range separately.
Example: 200 201 202 203 204 | 300 301 302 310 311 312 313 | 400 401 402 403
for id in {200..204} {300..313} {400..403}; do pct stop $id; done
Similarly, to start these containers
Ensure that the Proxmox container IDs you want to manage fall within the specified ranges.
Double-check the container IDs before running these commands to avoid accidentally stopping or starting the wrong containers.
It's good practice to backup or ensure that it's safe to perform these operations, especially in a production environment.
Using these commands, you can efficiently manage multiple containers in batches without needing to type each ID individually.
This will STOP all from 100 to 9999
for id in {200..299} {300..399} {400..499} {500..599} {600..699} {700..799} {800..899} {900..999} {1000..1999} {2000..2999} {3000..3999} {4000..4999} {5000..5999} {6000..6999} {7000..7999} {8000..8999} {9000..9999}; do pct stop $id; done
This will START all from 100 to 9999
for id in {200..299} {300..399} {400..499} {500..599} {600..699} {700..799} {800..899} {900..999} {1000..1999} {2000..2999} {3000..3999} {4000..4999} {5000..5999} {6000..6999} {7000..7999} {8000..8999} {9000..9999}; do pct start $id; done
Updated by Gareth Eaton 12 months ago · 5 revisions