Feature suggestion : allow pct enter to work with the hostname rather than ID number

shodan

Member
Sep 1, 2022
89
33
23
Example

Code:
root@proxmox:~# pct list
VMID       Status     Lock         Name
100        stopped                 test1
107        stopped                 ooga
115        running                 sdweb
116        stopped                 textgen
125        stopped                 comfyui
130        stopped                 nginx
131        stopped                 http-server
999        stopped                 myopenwrt
1001       stopped                 myopenwrt2
root@proxmox:~# pct enter sdweb
400 Parameter verification failed.
vmid: type check ('integer') failed - got 'sdweb'
pct enter <vmid> [OPTIONS]
 
bash workaround:


Code:
vmid=$(pct list |grep -m 1 sdweb |awk '{print $1}')
[ "$vmid" = "" ] && echo "Error" || pct enter $vmid

# substitute sdweb with $1 for OTF argument
 
bash workaround:


Code:
vmid=$(pct list |grep -m 1 sdweb |awk '{print $1}')
[ "$vmid" = "" ] && echo "Error" || pct enter $vmid

# substitute sdweb with $1 for OTF argument
That will always yield the container with the smallest VMID in case of multiple containers with the same name. If that is what you want, you can use it.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!