Virtual Machine uptime

GRB

New Member
Dec 5, 2008
4
0
1
Hi folks,

The gui displays the uptime of a virtual machine, is there a way to determine this from the command line?

Thanks

Glen
 
Hi dietmar,

Thanks for the reply, the only issue with using the date from ps is that calculating the uptime over the end of the year in a shell script can get messy due to the fact that you only get month and day in the output.

An easier method is to use the mtime from ls -l, but this relies on the fact that the .pid file is only updated when the machine is started. It appears to be the case but can you verify this for me.

Thanks again

Glen
 
Try

Code:
 ps -o time `cat /var/run/qemu-server/$VMID.pid`

But your code with ls should also work.

- Dietmar
 

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!