📜 ⬆️ ⬇️

Dklab_vzenter utility: vzctl enter on the host name (for OpenVZ)

dklab_vzenter is a very, very simple utility for system administrators that allows you to log into one or another OpenVZ container (vzctl enter), specifying the minimum consistent part of its domain name. Now there is no need to memorize the CTID or constantly type the vzlist command.

Installation is very simple. Enter the following commands on the host system:

  cd / usr / sbin 
 wget http://dklab.ru/lib/dklab_vzenter/demo/e 
 chmod + xe 

')
Usage format:

  # e <domain_name_part> 


At the same time, <__> may have missing letters anywhere (even in the middle), if this does not cause contradictions with other names in the system. Suppose there are 4 containers on your host system:

  web-a-01.pr.example.com
 web-a-02.pr.example.com
 ns1.example.com
 test.pr.example.com 


Let's look at examples of how the e command works (short for dklab_vzenter):

  # e web-a-01
 Entering web-a-01.pr.example.com
 entered into CT 110

 # e w1
 Entering web-a-01.pr.example.com
 entered into CT 110

 # e w2
 Entering web-a-02.pr.example.com
 entered into CT 111

 # e ns
 Entering ns1.example.com
 entered into CT 310

 # e test
 Entering test.pr.example.com
 entered into CT 210 


As you can see, dklab_vzenter tries to find such names that include the entered letters in the specified order, but not necessarily in a row. Now let's see what happens if there are several candidate names:

  # e web
 More than one match found, please detalise:
   110 web-a-01.pr.example.com
   111 web-a-02.pr.example.com 


Thus, the entrance to the container is possible only by entering a consistent sequence of letters from its domain name.

Source: https://habr.com/ru/post/69272/


All Articles