MASS - Starting and Stopping » History » Version 3
Gareth Eaton, 12/24/2023 01:00 PM
1 | 1 | Gareth Eaton | h1. MASS - Starting and Stopping |
---|---|---|---|
2 | |||
3 | h3. Stopping Containers |
||
4 | |||
5 | SSH into Proxmox Server: First, you need to SSH into your Proxmox server or access its command line through the console. |
||
6 | |||
7 | List All Running Containers: Use the command pct list to list all running containers. This will give you the IDs of the containers. |
||
8 | |||
9 | Stop Containers: To stop multiple containers, you can use a bash loop. For example: |
||
10 | |||
11 | <pre> |
||
12 | for id in {101..110}; do pct stop $id; done |
||
13 | </pre> |
||
14 | |||
15 | This command stops containers with IDs from 101 to 110. Adjust the range according to your container IDs. |
||
16 | |||
17 | h3. Starting Containers |
||
18 | |||
19 | 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. |
||
20 | |||
21 | Start Containers: Similarly, to start multiple containers, use a bash loop: |
||
22 | |||
23 | <pre> |
||
24 | for id in {101..110}; do pct start $id; done |
||
25 | </pre> |
||
26 | |||
27 | This will start containers with IDs from 101 to 110. |
||
28 | 2 | Gareth Eaton | |
29 | ---- |
||
30 | |||
31 | h2. Note: |
||
32 | |||
33 | 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. |
||
34 | |||
35 | 200 201 202 203 204 300 301 302 310 311 312 313 400 401 402 403 |
||
36 | |||
37 | <pre> |
||
38 | for id in {200..204} {300..313} {400..403}; do pct stop $id; done |
||
39 | </pre> |
||
40 | Similarly, to start these containers |
||
41 | 3 | Gareth Eaton | |
42 | |||
43 | Ensure that the Proxmox container IDs you want to manage fall within the specified ranges. |
||
44 | Double-check the container IDs before running these commands to avoid accidentally stopping or starting the wrong containers. |
||
45 | It's good practice to backup or ensure that it's safe to perform these operations, especially in a production environment. |
||
46 | Using these commands, you can efficiently manage multiple containers in batches without needing to type each ID individually. |