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

shodan

Active Member
Sep 1, 2022
235
66
33
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.