Skip to content

Instantly share code, notes, and snippets.

@Xenthys
Last active January 1, 2024 22:10
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Xenthys/eac5c4b46e8ad016ab8d6584883c754a to your computer and use it in GitHub Desktop.
Save Xenthys/eac5c4b46e8ad016ab8d6584883c754a to your computer and use it in GitHub Desktop.
A helper for Proxmox's "pct enter" to use containers' hostnames and enter them from any cluster node.
#!/bin/bash
id=$(grep "$1" /etc/pve/.rrd | cut -d'/' -f 2 | cut -d':' -f 1)
[[ "$id" == '' ]] && echo "The specified LXC does not exist." && exit 1
node=$(grep "^\"$id\":" /etc/pve/.vmlist | cut -d'"' -f 6)
[[ $(hostname) != "$node" ]] && pre="ssh -t $node "
echo "Entering LXC $id on node $node..."
${pre}pct enter $id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment