Posts Tagged ‘shell’

Simple Script to List and Remove All Stopped Docker Containers

May 27th, 2015 6 comments

While using Docker command lines, I found it’s sometime a bit confusing to deal with containers. For the underlying operating system, a container is like a process. That is why the docker command use “ps” as the command to list these commands.

However, the typical “ps” command lists all the running processes. When a process dies, it is gone and there is no need to list it at all. For the containers, the story is different. The container can also be stopped, paused, which is different from running state. But you can still bring them back to running state later.

How to Create New User in ESXi With Shell Script

August 7th, 2014 2 comments

It’s pretty easy to create a new user using vSphere APIs in Java. If you want one or two lines of scripts, you can write a few line Python script using PyVimomi wrapped by a command line. Even easier is a solution discussed at PureVirtual.

The trick is really about how to access the adduser command, which is available but not accessible from console as it is. To use the command, you have to type the following command from ESXi console: (I assume there are a few more commands that can be used in the same way)

Categories: Virtualization Tags: , ,

Powerful Hacks With ESXi vim-cmd Command, Together With Shell Commands

December 1st, 2013 10 comments

If you have read my previous article on the vim-cmd, you may have realized how handy it is, especially when it comes to manage virtual machines. There is however a pretty challenging problem to use it – for most commands for a virtual machine, it requires vmid which is an integer that uniquely identifies the virtual machine in the context of an ESXi server. It’s like primary key in SQL database to locate a record (virtual machine instance) in a table (virtual machine type). For people who are familiar with vSphere APIs, the vmid is the same as the value of ManagedObjectReference value of a virtual machine in ESXi. Because most administrators who use commands are not necessarily familiar with vSphere API, it doesn’t help much.

Categories: Virtualization Tags: , , ,