July 12, 2016

Erase last BASH command

enter image description here
Ever accidentally type your password on the commandline?
Want something better than editing the .bash_history file?
(Especially when you use cssh, parallel-ssh, psonsole or similar)
Below are some options:
#erase last command (least efficient)
history -d $(history | tail -n 2 | head -n 1 | awk '{print $1}')

#erase last command (more efficient)
history -d $(history | awk 'END{print $1-1}')

#erase last command and self (best)
history -d $(($HISTCMD-2)) && history -d $(($HISTCMD-1))

#ultimately add alias to .bashrc
alias eraselastcmd='history -d $(($HISTCMD-2)) && history -d $(($HISTCMD-1))'

#clear current session history
history -c

#don't save session history starting now
unset HISTFILE

#delete lines containing SOMETEXT from ~/.bash_history
 sed -i '/SOMETEXT/d' ~/.bash_history
Related options that can be set in ~/.bashrc
export HISTCONTROL=ignoreboth         # ignore duplicates and commands with " " (space-prefixed)
export HISTSIZE=                      # unlimited history
export HISTFILESIZE=                  # unlimited history
shopt -s histappend                   # append to history, don't overwrite it
export HISTIGNORE="ls:pwd:exit:date"  # do not record specified commands
-
good luck


Please consider crypto tipping:
  

June 07, 2016

vCSA 6 not sending email alerts


Thanks to AdminAfterWork.com's  for providing the reason and solution to my vCSA6 not email alerting.

http://adminafterwork.com/linux-based-vcenter-server-appliance-vcsa-bug-vcenter-email-notifications-sent-using-multiple-email-addresses-action-sending-notification-emails/

tl;dr: Use only one email recipient per action.
Please consider crypto tipping:
  

April 21, 2016

VMWare HP VIB repo "vibsdepot.hp.com" changed to "vibsdepot.hpe.com"

Have you used "vibsdepot.hp.com" as a VMWare Update Manager VIB Repository?

You may now be getting the error:
Cannot download software packages from patch source. Check the events and the Update Manager log for download details.

If so, edit the repo URL. Reference: https://vibsdepot.hp.com/SDR/repo/vibsdepot/

Quote:
Notices

New domain name: With the launch of the new company, Hewlett Packard Enterprise, please refer to this host as: "vibsdepot.hpe.com."   If you access this system using VMware Update Manager, VMware Image Builder or VMware vSphereCLI, please update your repository configuration files accordingly.

Please consider crypto tipping: