Skip to main content Logo (IEC resistor symbol)logo

Quis custodiet ipsos custodes?
Home | About | All pages | RSS Feed | Gopher

ProxBash - a bash script to manage Proxmox VE

Published: 28-06-2012 | Author: Remy van Elst | Text only version of this article

Table of Contents

Proxmox VE is a complete virtualization management solution for servers. You canvirtualize even the most demanding application workloads running on Linux andWindows Servers. It is based on the leading Kernel-based Virtual Machine (KVM)hypervisor and OpenVZ, the number one solution for container basedvirtualization.

Proxmox Website

ProxMox VE is a very nice piece of software to setup a VM host very fast, whichalso is easy manageable via a webinterface. It supports both OpenVZ and KVM. Iuse it to manage a few VM's to test stuff on and it works really great.

However, I'm a command line lover, and I thought it would be nice to be able to"Manage" Proxmox VE from a bash shell. And I've written a script to do justthat. is a bash script to manage your Proxmox VE server.

Check out my other Proxmox/OpenVZ related articles.

If you like this article, consider sponsoring me by trying out a Digital OceanVPS. With this link you'll get $100 credit for 60 days). (referral link)


As you can see there is a lot of OpenVZ and not a lot of KVM. Most of the VM's Iuse are OpenVZ, so for the KVM things you need to use the webinterface.


Click here to download the script

Or use this:

wget; chmod +x ./; ./

Before you start, edit the script variables:

VAR_PROXMOXHOST=""    #proxmox server IPVAR_PROXMOXSSH="22"         #proxmox ssh portVAR_PROXMOXUSER="root"          #proxmox ssh userVAR_PROXMOX_NODE="proxmox"      #proxmox cluster node name

and set up passwordless key auth to the proxmox node. If you don't do that, youhave to enter the proxmox root password every time.

Also edit the case statement for the templates. Default it has ubuntu 10.04and 12.04 and centos 5 and 6.

Replace $CTID with an openvz ct id. (like 103, 104)

Create a CT createct node-hostname node-password node-template node-ram node-disk createct prod001 supersecret1 ubuntu12 1024 15 createct node-hostname node-password node-template node-ram node-disk node-ip $CTID

Start/Stop a CT
./ startct ./ startct $CTID   ./ stopct./ stopct $CTID
Remove a CT
./ deletect./ deletect $CTID
Shell dropper
./ shelldrop $CTID
Execute commands in CT
./ execinct $CTID "commands you -want -to; execute; in the ../ct" 
List CTs/VMs
./ listcts./ listvms
Get CT info
./ ctinfo./ ctinfo $CTID

If you like it or use it, please leave a comment.

Tags: bash, kvm, openvz, proxmox, proxmox-ve, software, ssh, virtualization