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