Monday, August 1, 2016

Force Reboot/Shutdown Linux Box

I had a linux box that would just not shutdown/reboot and I didn't have physical access.   After some searching, I found the following blog and commands.

Reboot


  • echo 1 > /proc/sys/kernel/sysrq 
  • echo b > /proc/sysrq-trigger


Shutdown


  • echo 1 > /proc/sys/kernel/sysrq 
  • echo o > /proc/sysrq-trigger


This worked perfectly for my needs

Saturday, July 16, 2016

Restore ESX Configuration

Yesterday on ESX 5.0 (Unfortunately, this customer doesn't have the option to upgrade), I was able to restore the backup using vSphere CLI.

The Process:
  1. Reinstall ESX. 
  2. Get an IP Address (We have a small DHCP pool for our management vlan) 
  3. Issue the following command: vicfg-cfgbackup.pl --server=ESXi_host_IP_address --username=root -l backup_file 
  4. ESX will reboot and come back up with the old configuration. I didn't have to touch VCenter.
And you are done.  It was rather easy and saved me a little bit of time.

Thursday, July 14, 2016

Backing up ESX Config

Recently, I looked into backing up ESX configuration because I needed to do a reinstall.   I was just looking for a way to speed up the re-install process.  We are using shared storage for the VMs so this isn't required.

What I found was two methods.   I will be using them both and report back with the results on the recovery process.

Backup Process 1:

#ssh to your host and run the following commands

# Sync config to store files
vim-cmd hostsvc/firmware/sync_config

# Create Backup
vim-cmd hostsvc/firmware/backup_config

# This will provide you with a download link you can use in your web browser

Backup Process 2:

# Install vSphere CLI

# Run the follow commands via cmd
cd C:\Program Files (x86)\VMware\VMware vSphere CLI\bin\
vicfg-cfgbackup.pl --server=<server IP> --username=root -s <Save backup file location and name>

Wednesday, July 13, 2016

Linux Startup Scripts Made Easy

A friend sent me the following link.  Its an awesome utility for creating startup scripts on any linux distro for applications that do not have scripts built into the package/installer.

Enjoy.

Sunday, July 10, 2016

Working with SaltStack

I recently started working with Saltstack to build and manage some linux appliances I have been building for my company.  I am by no means an expert.  Just someone learning a new product.

I plan to document some of what I learn and probably a lot of mistakes I make.  This is more for myself but figured it might come in handy for others.  If you notice a mistake or a better way of handling something, just let me know.

Sunday, July 3, 2016

SMTP Relay For Your Lab (Using Gmail)

In my home lab, I have several applications that send email.  Most of them run on linux (CentOS or Ubuntu).

I found the following directions to setup Postfix.  I started doing this on every box and realized I was being dumb.  I just need to setup one relay server.  I thought about setting up a services box for this and other functions but found a distro that does everything I wanted.

I installed Zentyal and configured the mail server to relay mail through my Gmail account.  Then just point all my other applications/servers at this internal relay.  Problem solved.  Now on to getting everything to authenticate through ldap, etc.