Moving the repositories

As a few of you might know, I’m going to leave the Centre for Information Technology at Technical University of Ostrava within a few weeks. It’s been great fun to work here all the time but the last year. There’s no call for me to stay, almost everybody I have admired had left. The fun has gone away too. Well, this means I have to move my repositories which I have brought to University. [Read More]

Powercli to list & delete snapshots

We have realized we are having broken NetApp VMs backup. The process left a lot of VM snapshots. To start off let’s find out those snaps with: get-vm | get-snapshot | where {$\_.Description -match "SMVI Snapshot generated for backup"} | Format-Table -Property VM,Name,Created,Description, SizeMB This command prints the flowing table: VM Name Created Description SizeMB -- ---- ------- ----------- ------ vyuka.fs smvi\_a3d... 23.11.2012 17:56:25 SMVI Snapshot... 6768,13 ojs smvi\_a3d... 23.11.2012 18:01:25 SMVI Snapshot. [Read More]

Git to list changed files

Today I want to make a brief summary of git log possibilities. There’s a huge range of git log commands to choose from. I have chosen only a few. Let’s limit git response to the latest commit with HEAD^! target. So here we go: git log HEAD^! commit 68d0e02d20bdbdbaf3bce24ea5cfd51a854157a8 Author: David Hrbáč Date: Sat Dec 8 16:10:44 2012 +0100 dnsmasq-2.64-1: new upstream release git log --name-only HEAD^! commit 68d0e02d20bdbdbaf3bce24ea5cfd51a854157a8 Author: David Hrbáč Date: Sat Dec 8 16:10:44 2012 +0100 dnsmasq-2. [Read More]
git 

PowerCLI to start and stop Remote Tech Support (SSH)

Another PowerCLI one-liner to start Remote Tech Support (SSH) on ESX/ESXi:

Get-Cluster -Name "CIT2 CLuster" | Get-VMHost | Get-VMHostService | ? {$\_.Key -eq "TSM-ssh"} | Start-VMHostService

One-liner to stop:

Get-Cluster -Name "CIT2 CLuster" | Get-VMHost | Get-VMHostService | ? {$\_.Key -eq "TSM-ssh"} | Stop-VMHostService -Confirm:$false

Sed to extract email addresses from file

sed -e "s/^.\*<\(.*\)>.*$/\1/" /file_with_emails | sort | \\ uniq | tr "[:upper:]" "[:lower:]" PS: Filip, he’s terribly smart, I guess the only one to read my blog, pointed out the following one-liner: sed -nr "s/.*<([A-Z0-9._%-+]+@[A-Z0-9.-]+\.[A-Z]{2,4})>.*/\L\1/pi" \\ file_with_emails | sort -u Comments: Filip - Jun 4, 2012Hi. This one does the lowercase conversion immediately and lists only e-mails in a valid format. sed -nr "s/.*.*/\L\1/pi" file_with_emails | sort -u Filip - Jun 4, 2012Sorry, WP isn’t friend of my sed oneliner. [Read More]
sed 

Get VM ethernet info and state

PowerCLI > Get-VM -Name builder2 | Get-NetworkAdapter| Format-List -Property \*

MacAddress       : 00:50:56:90:34:9d
WakeOnLanEnabled : True
NetworkName      : Network 158.196.149.0
Type             : e1000
ParentId         : VirtualMachine-vm-4650
Parent           : builder2
Uid              : /VIServer=administrator@vcs1.vsb.cz:443/VirtualMachine=Virtu
                   alMachine-vm-4650/NetworkAdapter=4000/
ConnectionState  : Connected, GuestControl, StartConnected
ExtensionData    : VMware.Vim.VirtualE1000
Id               : VirtualMachine-vm-4650/4000
Name             : Network adapter 1
vmware 

Get VMs with disconnected virtual ethernet

PowerCLI > Get-NetworkAdapter (get-vm | where {$\_.powerstate -eq poweredon}) |
Where { $\_.connectionstate.connected -eq $null } | select parent, connectionstate

Parent                                  ConnectionState
------                                  ---------------
licenser                                NotConnected, GuestControl, NoStartC...
vmware 

Centos 6 public key authentication fix

Due to SELinux enabled we are not able to use public key authentication on Centos 6. Here is the quick fix:

test -x /sbin/restorecon && /sbin/restorecon .ssh .ssh/authorized\_keys